Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question
    
Where do your EPS images come from that they don't work with epstopdf? –  Will Robertson Sep 8 '10 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 '10 at 4:16
    
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 '10 at 6:31
    
See also How to convert PDF to EPS?. Some tools are able to convert both ways (Ghostscript, InkScape). –  Martin Scharrer Jul 6 '11 at 13:34
    
A simple command is: epspdf file.eps I wonder how people here did not find this! –  Snehal Shekatkar Dec 19 '13 at 10:46

3 Answers 3

up vote 17 down vote accepted

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.

share|improve this answer
    
sorry... yeah, mistake... I meant epstopdf –  Noli Sep 8 '10 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 '10 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 '10 at 22:50
    
+1 for inkscape which works really nice for me. No issues with font changes etc. so far. –  Martin Scharrer Jul 6 '11 at 13:32

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.

share|improve this answer
    
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 '10 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 '10 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
\documentclass{minimal}
\usepackage{pstricks}

\pagestyle{empty}
\begin{document}

\begin{pspicture}[showgrid=false](3,3)
\pscircle(1.5,1.5){1}
\rput[tr](3,3){3}
\end{pspicture}

\end{document}

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.

share|improve this answer
    
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 '11 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) –  Martin Scharrer Jul 6 '11 at 13:51
    
@xport: Simply use lang-none then. –  Martin Scharrer Jul 6 '11 at 13:56
    
@xport: You forgot the indention. Use a normal code block but add the language specification before. See my edit. –  Martin Scharrer Jul 6 '11 at 14:39

Your Answer

 
discard

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.