How can I easily crop a PDF page in a given PDF file? I prefer using as little coding as possible, and guess border geometries as little as possible...
4 Answers
There are several options:
- Crop by point-and-click using a GUI front-end:
- Crop by using the command line:
pdfcrop
command (provided by texlive-extra-utils), using the following arguments:pdfcrop --margins '-30 -30 -250 -150' --clip input.pdf output.pdf
(-left -top -right -bottom format).- PDFCrop
convert -crop
command (provided by imagemagick)- Ghostscript
- Crop by writing your own script:
For quick, GUI-aided PDF cropping tasks, try pdfarranger (available in Debian repos, formerly known as PDF-Shuffler).
For precise point-and-click cropping, one option is to use LibreOffice Draw.
The instructions below assume you want to crop part of a single-page PDF:
- Start with a blank document
- Select the
Insert > Image...
menu - Navigate to the PDF you wish to crop
- The contents of the PDF will show up as an image
- Right-click on the PDF content in your document and select the "Crop" menu item.
- Use the handles to resize the viewable area of the PDF to the section you want to remain after cropping
- Click outside of the PDF to disable the crop handles
- Click again on the PDF content to position it however you want by:
- Dragging it around the page
- Using the arrow keys to move it
- Use the Draw positioning tools to align or center the PDF content.
When you're happy with the result, save, export it to PDF, or print it.
For multi-page PDFs, You'll have to work page by page by first splitting the PDF into multiple pages using some other tool like PDF Arranger (or simply "Printing to PDF" each page of the PDF you want to crop in your PDF viewer), cropping them one by one with Draw, then recombining them into a single PDF (using PDF Arranger again).
You could try using the pdfCropMargins Python program (https://pypi.org/project/pdfCropMargins/) with the -pg
option to select the particular page. The command-line program offers many options, and also has an optional GUI.