[Tex/LaTex] How to crop included PDF documents


I've got a PDF that is automatically generated from a certain piece of software, that I want to include in the report I'm writing. I'm using pdfpages which gets the job done elegantly, but the problem is, the PDF has a lot of white space around the actual content (which is a graphics) and I always have to do some tedious post-processing of the automatically generated document so that it fits well in my report. Changing the output of the software to eliminate the white space is not an option (or at least, would be much more trouble than it's worth).

I checked the pdfpages manual, but wasn't able to find an option that does that. Ideally, I'd like to be able to set margins from each direction, and the PDF is then cropped accordingly and included.

What other options do I have to control what portion of the included PDF is visible in the final document?

Best Answer

Run pdfcrop on the whole document, which will crop every page individually. I always use the pdfcrop from Heiko Oberdiek which is already part of every TeX distribution. You may also need to install perl.

You can then input the resulting PDF as usual with pdfpages or alternatively with \includegraphics[page=...]{<image>}.

Related Question