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