Rice University logo
 
Top blue bar image
 

How to crop a pdf file (and convert it to an eps file)

We are going to remove the margin (white space) around a figure in input.pdf. We do this in Linux (I do not find free tools in Windows yet). We need

  1. input.pdf a single-page image file
  2. pdfcrop executable (get from http://sourceforge.net/projects/pdfcrop/)
  3. pdf2eps script (get from http://tex.stackexchange.com/questions/20883/how-to-convert-pdf-to-eps)

I saved a copy of items 2 and 3 here. Of course, you need to put them in the search path and apply “chmod a+x” to them.

Then run the following

  $ pdfcrop --verbose input.pdf output.pdf
  $ pdf2eps 1 output

The second line will generate output.eps.

If we need to impose the same bounding box on more than one files, read the output of

  $ pdfcrop --verbose input1.pdf output1.pdf
  $ pdfcrop --verbose input2.pdf output2.pdf
  ...
  $ pdfcrop --verbose inputn.pdf outputn.pdf

Figure out the largest bounding box <left> <top> <right> <bottom>, and run

  $ pdfcrop --bbox "<left> <top> <right> <bottom>" input1.pdf output1.pdf
  $ pdfcrop --bbox "<left> <top> <right> <bottom>" input2.pdf output2.pdf
  ...
  $ pdfcrop --bbox "<left> <top> <right> <bottom>" inputn.pdf outputn.pdf

Comments are closed.