Thursday, 17 May 2007

EPS to PDF : how to avoid clipping

Again, the fancy world of interconverting formats. I had to convert a bunch of Encapsulated Postscript (.EPS) files (generated by Inkscape) into PDF pages, for work. No problem, I initally thought, there is ps2pdf that will help me.

Problem is, ps2pdf has the nasty habit to use a fixed page size by default, clipping everything that goes beyond the limits of the page. No matter if most of the drawing is outside the page: ps2pdf will silently and mercilessly cut most of it.

Added to this, ps2pdf documentation is bad by almost any standard. The problem is that ps2pdf is a script that relies on GhostScript, so ps2pdf docs are (mostly) GhostScript docs.

After almost 90 minutes of googling, I found what I needed. To convert an arbitrary EPS file into a PDF page of your standard GS page size, just type:

ps2pdf -dEPSFitPage file.eps file.pdf

9 comments:

berlinBat said...

thank you, thank you, thank you!

Unknown said...

great, thanks!

Sander said...

Thanks for the tip! Another useful one (that I myself actually needed and found thanks to this lead ;)) is -dEPSCrop. This one crops the page size to fit the original image size, so you don't have any white space in the PDF.

Pavle Boskoski said...

Thanks \times \infty

Thanks to Sander too. It is working ps2pdf -dEPSFitPage -dEPSCrop

Unknown said...

THANK YOU! you saved lot of my time (I spent at least 20 min to find yours. GOLDEN words about the fact it relies on ghostscript documentation!

THK said...

Thank you for this article. It helps. And I found another document might be helpful also:
http://pages.cs.wisc.edu/~ghost/doc/cvs/Use.htm#EPS_parameters

Unknown said...

It's now been more than 3 years since this post and the developers still haven't fixed this. Maybe they think it's not a bug. I'm glad there is a workaround though!

Thanks

Unknown said...

First of all, I am a very new linux user. I just simply use:
epstopdf filename.eps
and it works fine. How does epstopdf compare to ps2pdf -...?

Ronald said...

To convert eps to pdf, you could also use epspdf from the TeXlive package. Depending on version/packaging this may reside in the texlive-pictures package. Works perfectly for me, without the buggy/obscure and poorly documented switches that ps2pdf needs if you deviate from the default page size.