TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently, my epstopdf is not able to convert eps to pdf correctly due to the boundingbox (atend) bug that the epstopdf does not support. However, I intend to use pdfcrop on the generated pdf file and that usually fix the white space problem. However, I have to manually fix every generated file. Is there a way to automate this in latex? For example, automatically calling pdfcrop immediately after epstopdf. I tried using DeclareGraphicsRule in epstopdf but it wasn't working.

Please advise. Thanks a lot ! :)

share|improve this question
Which bug? atend is supported by epstopdf. – Heiko Oberdiek Nov 7 '12 at 10:56
up vote 6 down vote accepted

The following adds an option crop to graphicx/\includegraphics. If enabled, it adds pdfcrop to the conversion of .eps to .pdf.

Because pdfcrop is not added to the restricted shell escape command list, full shell escape is needed: --shell-escape (TeX Live) or --enable-write18 (MiKTeX).

If the file is converted and uptodate, changing the option crop does not have an effect. Also the option does not affect other image files.


  \csname Gin@pdfcrop#1\endcsname
  epstopdf --outfile=%
    tmp-image.pdf #1 &&
    pdfcrop tmp-image.pdf \OutputFile

Example usages:

share|improve this answer
oh wow.. this works beautifully! Thanks so much.. appreciate it :) :) – Ivan Nov 7 '12 at 12:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.