Search code examples
pdfconvertersghostscripteps

Ghostscript: How to convert EPS to PDF with the same page size


I want to convert a EPS figure to a PDF figure with the same width and height.

The following command:

gswin32 -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH \
  -sDEVICE=pdfwrite -sPAPERSIZE=letter -dCompatibilityLevel=1.4 \
  -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 \
  -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile="test.pdf" \
  -f "test.eps"

only produces a PDF file with the page size of a letter.

Any help would be much appreciated.

Here is the test EPS file: https://dl.dropboxusercontent.com/u/45318932/test.eps


Solution

  • EPS files cannot contain a media size request. In the absence of any media size request Ghostscript uses the default.

    However.....

    From the documentation:

    http://www.ghostscript.com/doc/9.15/Use.htm#EPS_parameters

    -dEPSCrop : Crop an EPS file to the bounding box. This is useful when converting an EPS file to a bitmap.