Crop pdf files in linux

Crop pdf files in linux

PDFCrop is particularly useful to academics who print downloaded journal articles and people who receive PDF documents designed for letter size paper, but need to print the pages on A4 paper (or vice versa).

For example, an academic may get a journal article in which the PDF pages are only 5in. x 7in. If the he/she prints the PDF file with a standard GNU/Linux PDF viewer on letter size paper (8.5in. x 11in), there will be 1.75in white margins on the left and right sides and 2in. white margins on the top and bottom. (In other words, the white margins will consume 63 percent of the square area on the page).

International differences in paper size make PDFCrop indispensible. Letter size paper is the most common paper size in the United States, Canada and Mexico, while most other countries use A4 size paper. Consequently, Americans and Italians who exchange documents with each other may experience printing problems because letter size paper is 8.5in. x 11in, while A4 size paper is 8.27in x 11.7in.

PDFCrop solves these problems by removing the white margins and rescaling the pages to fit the user’s desired paper size.

BEFORE AFTER


Cool! How do get PDFCrop?

Easy. You download it from SourceForge.

How do I install PDFCrop?

PDFCrop depends on ghostscript and PDFedit.

Assuming that you have already installed these packages, then simply make sure the file «pdfcrop» is executable (i.e.: chmod 755 pdfcrop ) and copy it to a directory in your $PATH . For example: /home/eric/.bin/pdfcrop Alternatively, you could (as root) copy it to /usr/local/bin/pdfcrop

In future work, I’ll create a nice DEB package, so that it can be incorporated into distributions of GNU/Linux.

How do I use PDFCrop?

Open a console, cd to the directory where the PDF file is located and type: pdfcrop infile.pdf letter outfile.pdf

That command will resize and rescale the pages of «infile.pdf» so that they fit on letter size paper. The new PDF file will, of course, be called «output.pdf»

What does PDFCrop do?

First, PDFCrop calls ghostscript to find the borders of the PDF’s bounding box. Next, it determines the page orientation of each page of the PDF file. Finally, it calls PDFedit to crop and resize the pages.

PDFCrop should preserve the input file’s fonts, bookmarks and hyperlinks when generating the output file.

Known issues

Occasionally, the resulting PDF file cannot be displayed, but this is easily fixed by filtering the file through pdfopt (a part of ghostscript).

Older versions of ghostscript print the borders of the page bounding box twice, which will cause errors in the calculation of the page metrics and scale factor.

Why did you create PDFCrop?

I created PDFCrop because I hate small text and ugly white margins.

Only four releases in 28 months? Why don’t you spend more time working on PDFCrop?

Because I’m an evil bastard who works for peanuts at a time-consuming day job.

How can I provide suggestions? ask questions?

Easy. Place a note at the PDFCrop forums .

This script sucks! I could do a much better job!

Please do! I would be very happy if someone improved upon my work. That’s why PDFCrop is distributed under the terms of Open Source licenses.

Maybe one day PDFCrop (or its functionality) will be incorporated into Okular, Evince or PDFedit. Until then, you have this script.

Источник

6 Best PDF Page Cropping Tools For Linux

Portable Document Format (PDF) is a well known and possibly the most used file format today, specifically for presenting and sharing documents reliably, independent of software, hardware, or more so, operating system.

It has become the De Facto Standard for electronic documents, especially on the Internet. Because of this reason, and increased electronic information sharing, many people today get useful information in PDF documents.

In this article, we will list the six best PDF page cropping tools for Linux systems.

1. Master PDF Editor

Master PDF Editor is an easy-to-use and convenient, yet powerful multi-functional PDF Editor for work with PDF documents.

Master PDF Editor

It enables you to easily view, create and modify PDF files. It can also merge several files into one and split source document into multiple ones.

Addionally, Master PDF Editor helps you to comment, sign, encrypt PDF files plus lots more.

Features of Master PDF Editor

  1. It is cross platform; works on Linux, Windows and MacOS
  2. Enables creation of PDF documents
  3. Allows modification of text and objects
  4. Supports comments in PDF documents
  5. Supports creation and filling of PDF forms
  6. Also supports optical text recognition
  7. Supports several pages operations
  8. Supports bookmarks and digital signatures
  9. Ships in with a virtual PDF printer

2. PDF Quench

PDF Quench is a graphical Python application for cropping pages in PDF files.

PDF Quench Editor

It enables users to crop pages with correct rotation, defines PDF crop box to the same position as meda box, this helps to deal with the issue of cropping the 2nd time.

3. PDF Shuffler

PDF-Shuffler is a small, simple and free python-gtk application, it’s a graphical wrapper for python-pyPdf.

PDF Shuffler Editor

With PDF-Shuffler, you can merge or split PDF documents and rotate, crop and rearrange their pages using an interactive and intuitive graphical user interface.

4. Krop

Krop is a simple, free graphical user interface (GUI) application used to crop PDF file pages. It is written in Python and works only on Linux systems.

Krop PDF Editor

It depends on PyQT, python-poppler-qt4 and pyPdf or PyPDF2 to offer its full functionality. One of its other main feature is it automatically splits pages into multiple subpages to fit the limited screen size of devices such as eReaders.

5. Briss

Briss a simple, free cross-platform program for cropping PDF files, it works on Linux, Windows, Mac OSX.

Briss PDF Editor

Its remarkable feature is a straightforward graphical user interface, which allows you to define exactly the crop-region by fitting a rectangle on the visually overlaid pages, and other useful attributes.

6. PDFCrop

PDFCrop is a PDF page cropping application for Linux systems written in Perl. It requires ghostscript (for finding the borders of the PDF’s bounding box) and PDFedit (for cropping and resizing the pages) applications to be installed on the system.

It enables you to crop the white margins of PDF pages, and rescales them to fit a standard size sheet of paper; the resultant page is more readable and eye-catching after printing.

It is predominantly useful to academics, enabling them to print downloaded journal articles in an appealing manner. PDFCrop is also used by those who receive PDF documents structured for letter size paper, however need to print the pages on A4 paper (or vice versa).

That’s all! in this article, we listed the 6 best PDF page cropping tools with the key features for Linux systems. Is there any tool we have not mentioned here, share it with us in the comments.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

Инструмент командной строки для обрезки файлов PDF

Убедитесь, что содержание /etc/mailname равно example.com. Если нет, измените его и перезагрузите:

sudo nano /etc/mailname sudo reboot

9 ответов

Это может помочь тебе.
Это соответствует более новой версии Ubuntu и жизни. Это Master PDF Editor . Вы можете использовать его, обрезать, добавлять некоторые вещи и т. Д.

Пример:
Это до Это после ctrl + k

Я бы посоветовал вам взглянуть на PDFcrop .

Если вы хотите обрезать PDF с левым, верхним, правым и нижним полями 5, 10, 20 и 30 пунктов (точек), то запустите

в терминале. Чтобы фактически обрезать что-то, используйте отрицательные значения в аргументе для обрезки. Например,

обрезает 50 пунктов слева, сверху, справа, снизу (в этом порядке).

Если вы выполните только команду pdfcrop input , она выведет файл с именем input-crop.pdf с нулевыми полями. Я нахожу это очень удобным, когда включаю PDF-иллюстрации в документы.

Обрезка нескольких файлов

К сожалению, pdfcrop не может обрезать несколько файлов одновременно. Однако легко написать скрипт, который будет обрезать все PDF-файлы в папке, в которой находится скрипт.

Создайте новый пустой файл и назовите его something.sh . Откройте его в текстовом редакторе и вставьте следующее:

Сохраните его и закройте. Затем щелкните файл правой кнопкой мыши, перейдите в Свойства> Разрешения и установите флажок Разрешить выполнение файла как программы . Теперь закройте диалог. Запустите скрипт, дважды щелкнув его и выбрав Запустить в терминале . И новая, обрезанная с нулевым полем версия всех PDF-файлов с суффиксом -crop теперь будет напечатана в папке. Если вам нужны поля или другие вещи, вы, конечно, можете просто открыть скрипт и добавить аргументы после pdfcrop .

Источник

PDF crop. Чем?

В общем, нужно тут было отсканировать книжку в PDF.

Simple Scan справился с задачей легко, сохранил первоначальный кривой некропнутый вариант в PDF, сделал кроп для страниц и при сохранении Simple Scan благополучно упал.

Так что у меня есть только PDF с кривыми необрезанными страницами. Естественно, вразнобой, так что скриптом задача не решается. Сохранять несколько десятков страниц в картинки, кропать по одной в том же GIMP, пересохранять, потом снова собирать в PDF — редкостное извращение, достойное строительства троллейбуса из буханки хлеба.

Нет ли более вменяемого инструмента? PDFEdit — жуткое извращение с ручным введением параметров кропа для каждой страницы. PDF Crop — аналогично, только весит меньше и параметры вводить ещё неудобнее.

Неужели нет нормального инструмента, в котором прямо как в Simple Scan можно бы было просто мышкой отметить границы каждой страницы и сохранить результат?

Зачем же в пдф сканировать? Все давно отработано.

Если у тебя установлен texlive-extra-utils. В нём есть pdfcrop

Пакетное сканирование с моим сканером умеет Scan2pdf. Затем сохранить страницы (неразделённые) как tiff. Импортировать каталог с tiff в ScanTailor. Дальше всё полностью автоматизировано.

Источник

Crop pdf files in linux

How to crop PDF documents pages using free and open source applications, GUI and command line.

If you ever needed to crop pages of a PDF document and you are using a Linux computer here are six tools that can help you. All are native Linux applications, some are opensource, but most important all are free.

I looked for the following features at these applications: the ability to select only a subset of pages from the document to crop, different crop boxes for each page and the way of selecting crop box (automatically, WYSIWYG or by measurement units).

Here are the six Linux applications that will help you when you need to crop a PDF. This is just a list, not a ranking.

1. BRISS

This is a Java based cross-platform tool that can be downloaded from SourceForge. It allows you to select what pages will be processed by pages numbers, but not by preview. Once you load a PDF document it will prompt you to enter a page range to crop. After you selected some pages or all by clicking Cancel in that dialog, it will automatically calculate crop boxes and will display previews.

You can define individual crop boxes for each page. You can adjust crop box size by clicking and dragging the top left and bottom right corners. But more important, in the Rectangle menu you will options to set size and position of crop box using milimeters.

To select a crop box, you have to right click the rectangle and choose Select/Deselect rectangle. And now you will also see the rectangle size in milimeters.

BRISS main window with a selected rectangle

2. PDF Shuffler

This is a PDF utility found in most Linux repositories. You can also get it from SourceForge. It allows you to select pages that you will apply a crop box to in a visual way using previews which is a good thing. You can also use different size crops for each page. But the fact that it uses percent instead to specify crop box size and location makes it quite difficult to use. There is no way to draw the crop box with the mouse either. And no automatic cropping.

PDF Shuffler crop

3. PDF Quench

Here is a Python script that use PyPDF2 library to crop PDF pages. You can get it from GitHub. Be sure to install python-pygoocanvas python-poppler python-pypdf2 and you can launch the script.

This is a simple utility: no page selection, no different crop boxes for each page. The only way to draw the crop rectangle is by using the mouse. And while you can adjust it on each page, it will apply to all. No automatic crop.

PDF Quench

4. Krop

Qt based PDF cropper with a lot of features that should be available in the repositories. Can be found also at Armin Straub’s site. You can choose input page range and you can apply different crop rectangles to every page. It features automatic margin cropping. The only way to draw a crop box is by using mouse cursor. However you can right click that selection and choose to automatically trim white margins of that selection only. Unfortunately, no way of specifying rectangle size using measurement units.

Krop main window

5. pdfcrop

It’s time to go to the command line. This is an utility found in texlive-extra-utils package. If you run it without options, it will automatically crop white margins of all pages. There is no way to select page range or apply different crop boxes to different pages. The crop box size is defined in pt units. 1 pt represent a pixel at 72 DPI, so 1pt = (1 / 72) x 25.4 = 0.35mm or 1mm = 2.83pt.

It has however an useful feature. You can enlarge page size of a PDF document with it by specifying a crop box equal to the page size then adding margins. An usage example can be found in How to add printer marks and bleeds to PDF documents article.

6. Master PDF Editor

All the above were open source. Here is a PDF editing suite free for personal non-comercial use. You can get Master PDF Editor from Code Industry website. It has a lot of PDF editing functions and it is also a fast viewer.

You can add individual crop boxes for each page or page range. To start, go to Document — Crop pages. Then draw a rectangle on any page of any size. A dialog will open that will allow you to configure crop box size by different units and page range. No automatic crop available.

Master PDF editor crop pages

Conclusion

All of the presented apps have advantages and disadvantages, but you should find at least one that fulfills your requirements. Here is a comparison table:

Источник

Читайте также:  Установка дебиан рядом с windows 10
Оцените статью