How to Crop PDF Files on a Mac Using Free Tools Only

October 1, 2011

(Update: Newer versions of Calibre no longer bundle pdfmanipulate, meaning that the instructions below may no longer be valid).

If you use your iPad, iPhone, Android tablet or even your PlayStation Portable for PDF reading you probably already noticed that big margins, in this context, don't contribute to the reading experience. This is specially true with PDF readers that don't feature fine-grained zooming or smooth scrolling, making it difficult to hide the margins in order to maximize the reading area.

In this post I'll explain how you can crop the margins of (almost) any PDF file on a Mac using a free tool: Calibre. Calibre is an ebook manager with some conversion and editing features that can be accessed from the application's graphical user interface or from the command line.

Although I never use Calibre as an ebook manager per se I use its pdf manipulation tools regularly, always from the command line. The advantage of the command line is that ebook files don't need to be added to Calibre's library in order to be processed. Also, I personally don't like Calibre's user interface very much so I tend to stay away from it!

On a Mac you can access the command line utilities using the Terminal application. Assuming that Calibre was installed in the Applications folder, open a Terminal window and execute the following command to see which utilities are available:

ls /Applications/calibre.app/Contents/MacOS

The one that we'll be using to crop PDF margins is called pdfmanipulate. In order to run it from anywhere in the file system you must add the previous folder to the system's path:

export PATH=\$PATH:/Applications/calibre.app/Contents/MacOS

To make sure everything is working as expected run pdfmanipulate just by writing its name:

pdfmanipulate

If the usage instructions are displayed as result you are now ready to start "manipulating" some PDF files!

Cropping PDF Margins Using the CROP Option

To see the usage instructions execute pdfmanipulate crop on the Terminal. Here's a visual representation of the main options:

pdfmanipulate crop arguments

So, in the example above we're cropping 50 pixels from the left side of the page, 60 pixels from the top, 50 pixels from the right and 60 pixels from the bottom. The output will be written to a file named cropped.pdf (default when no output file name is defined).

Getting the right value for each parameter is a matter of trial and error. Some useful tips:

  • You have to guarantee that values are valid for all pages with actual content (usually cover pages and the like can be ignored), so you should validate the result with the most "crowded" pages of the document.
  • Keep the output PDF file opened in Preview as you try new values; the file will be automatically refreshed showing the new result and maintaining the position in the previously opened page.