Friday, July 23, 2010

How to cut/crop white margins of a pdf file

Sometimes we want to cut the white margins of a pdf file. For example, the pdf plots saved from Paraview have large white margins. The whole image takes 1 page, while the actual figure only takes about half of the page.

In Linux, there is a simple command to solve this problem. For example, assume your file is called ``ort.pdf''. Then you can remove the white margins using this simple command:
$pdfcrop ort.pdf

If you need to apply this crop operation to many pdf files, then you can use the following tiny script to automate:
$for file in `ls *.pdf`; do pdfcrop $file; done

1 comment:

Anonymous said...

Thank you very much! These small tools is one of the main reasons I love linux.

Visitors