If your work involves reading a lot of PDF files, I am sure you'd have sometimes thought about removing those empty margins from PDF file pages in order to get a better reading experience on your hand-held device, like your phone or Kindle.

But did you ever find a way to do that? And on Linux? Well, if you are still looking for such a solution on Linux, you'll be glad to know that we'll be discussing a tool that lets you do what you want.

But before we do that, please note that all the commands and instructions mentioned in this article have been tested on Ubuntu 16.04.

PDFcrop

Yup, PDFcrop is the tool we'll be discussing. It's basically a Perl script that's part of the texlive-extra-utils package. So, in order to install PDFCrop, you'll have to install this package first.

sudo apt-get install texlive-extra-utils

Note: The installation may take time as the package is a bit heavy (over 600MB in my case).

Once texlive-extra-utils is installed, rest assured that PDFcrop will now be there on your system. Now, here's the command that'll remove empty margins from an input PDF file and produce a cropped output PDF file.

$ pdfcrop [input.pdf] [output.pdf]

Here's an example that I tested at my end:

pdfcrop-command

And here are the input and output PDF files:

pdfcrop-input-pdf

So you can see that the empty margins (present in the input PDF) were removed in output PDF file. For more details on the PDFcrop tool, head here.

How to remove margins and bring down PDF file pages to their minimal size

Leave a Reply

Your email address will not be published. Required fields are marked *

*