I'd like to try to use pdfLaTeX to generate PDFs but my images are all in EPS. I would also like for the images to remain scalable.

I have tried using ImageMagik's convert:

convert file.eps file.pdf

but the result does not look good and the image becomes grainy after a few zooms.

I try epstopdf file.eps, but get the following error message:

Error: /undefined in II*
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop   --nostringval--   1861   1   3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1160/1684(ro)(G)--   --dict:1/20(G)--   --dict:89/200(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.71: Unrecoverable error, exit code 1

which doesn't really tell me anything.

Anyone know any other ways to convert EPS to PDF? (I have about 200 images, so command-line is better)

  • Where do your EPS images come from that they don't work with epstopdf? Sep 8, 2010 at 3:38
  • illustrator CS3.. actually most seemed to work ok in the end, but one cover page got so cropped with epstopdf that I had to resave it as pdf from illustrator directly. No idea why..
    – Noli
    Sep 8, 2010 at 4:16
  • 1
    I too have received errors like that when using epstopdf. I've found that in those cases running eps2eps before seems to work.
    – TH.
    Sep 8, 2010 at 6:31
  • See also How to convert PDF to EPS?. Some tools are able to convert both ways (Ghostscript, InkScape). Jul 6, 2011 at 13:34
  • 1
    A simple command is: epspdf file.eps I wonder how people here did not find this!
    – Peaceful
    Dec 19, 2013 at 10:46

3 Answers 3


epstopdf, of course, which is what the epstopdf package relies on. (If you used the package there would be no need to convert.)

Or is that what you meant by eps2pdf? I've never noticed any problems with it.

I suppose you could also try Inkscape; I think it does have some batch functions, perhaps even command-line options for conversion, even though it is principally a GUI app.

EDIT: Judging by the inkscape manual, you could just do:

inkscape --export-pdf=output.pdf input.eps

EDIT2: Actually, you might need to use SVG input for inkscape export on the command-line; I'll look into this a bit more. You could do it through the GUI, though.

  • sorry... yeah, mistake... I meant epstopdf
    – Noli
    Sep 8, 2010 at 3:11
  • The epstopdf package relies on \write18 being enabled. It's a nice feature, but a bad idea. Just run epstopdf yourself.
    – TH.
    Sep 8, 2010 at 6:30
  • @TH: You could just pass the appropriate command-line flag to pdflatex, which you can find in the epstopdf manual...
    – SamB
    Sep 14, 2010 at 22:50
  • +1 for inkscape which works really nice for me. No issues with font changes etc. so far. Jul 6, 2011 at 13:32
  • Thanks, very useful. I managed this on WSL2 inkscape install on a folder with many eps using this magic for i in *.eps; do echo $i; inkscape --export-pdf=${i%.eps}.pdf $i; done. See unix.stackexchange.com/questions/19654/… Oct 11, 2023 at 7:19

You can use ps2pdf with options to suppress resampling and lossily compressing images -dAutoFilterColorImages=false and -dColorImageFilter=/FlateEncode. (On windows, replace the = by #).

ps2pdf may not keep the same bounding box, unlike epstopdf, but you can fix that either by copying the logic from epstopdf (eg, edit epstopdf.pl to add those options to the ghostscript command line) or you can redo the clipping by using pdfcrop.

  • With those flags, will ps2pdf also avoid decoding images using the DCTEncode filter, such as would be produced by losslessly converting a JPEG file to EPS with pts.szit.bme.hu/sam2p?
    – SamB
    Sep 14, 2010 at 23:09
  • 1
    @SamB Adobe Distiller (since version 6) has a parameter PassThroughJPEGImages. Unfortunately, ghostscript (the engine underlying ps2pdf) does not support this distiller parameter. See item 3.8 in the ghostscript projects page (has been a project since 2000, don't hold your breath). Because of this, sam2p is much less useful than it seems at first, and using eps as an intermediate format on the way to pdf is not attractive.... See this answer
    – Lev Bishop
    Sep 14, 2010 at 23:39

I always use the following batch file

echo off
latex %1
del %1.log
del %1.aux
dvips %1 -E -o %1-crop.eps
del %1.dvi
epstool --copy --bbox %1-crop.eps %1.eps
del %1-crop.eps
epstopdf --hires %1.eps

in my job to compile an example:

% gridoff.tex




It runs without problem. The important parts that you need are

epstool --copy --bbox input.eps output.eps
epstopdf --hires output.eps

The first invokes GhostScript to append high resolution bounding box. The last converts EPS to PDF with high resolution bounding box.

  • epstool is also relevant in another matter. Illustrator may embed a preview image into the EPS, which epstopdf then does not like. To remove it use epstool -p input.eps output.eps
    – daleif
    Jul 6, 2011 at 13:12
  • While I told you to use <pre> tags for non-TeX code, Caramdir's suggestion to use language specifications is actually better. See Is there some trick to writing code snippets? on meta now. (No reason to change existing post; just for future reference, because it is easier and leads to better results) Jul 6, 2011 at 13:51
  • @xport: Simply use lang-none then. Jul 6, 2011 at 13:56
  • @xport: You forgot the indention. Use a normal code block but add the language specification before. See my edit. Jul 6, 2011 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .