How to set the physical size of PDF pages with Ghostscript?
Asked Answered
S

2

3

I want to convert a bunch of .eps images to a single PDF using Ghostscript.

But when I look at the PDF file in a PDF viewer and set view to 100% to physical size of the file is huge!

I would like to force gs to create the PDF in letter size, but everything I tried failed. Here's the command I'm using:

gs -dBATCH -dNOPAUSE -dEPSFitPage -dEPSCrop \
   -q -sDEVICE=pdfwrite -sOutputFile=out.pdf \
    file1.eps file2.eps

All my attempts with -sPAPERSIZE=legal and -dDEVICEWIDTHPOINTS=w -dDEVICEHEIGHTPOINTS=h had no effect.

Shonna answered 30/1, 2013 at 2:7 Comment(0)
S
2

The problem was -dEPSFitPage it was fitting the page size to the .eps file size... using -dPDFFitPage (and skipping the mutually exclusive -dEPSCrop) solved my problem.

gs -dBATCH -dNOPAUSE -sPAPERSIZE=letter \
   -dPDFFitPage -q -sDEVICE=pdfwrite \
   -sOutputFile=out.pdf \
    file1.eps file2.eps
Shonna answered 30/1, 2013 at 2:56 Comment(0)
V
4

-dEPSFitPage and -dEPSCrop are mutually exclusive. Try getting rid of the -dEPSCrop and putting back -sPAPERSIZE=legal. If that doesn't work, it is probably because the .eps file is over-riding the media, so try adding -dFIXEDMEDIA.

BTW, this answer is cribbed from: Fit to page size in ghostscript (with a possibly corrupt input)

Vizierate answered 30/1, 2013 at 2:20 Comment(2)
I tried to replace -dEPSCrop with -sPAPERSIZE=legal but same thing. doing identify -verbose out.pdf I see: Print size: 23.6111x30.5556Shonna
Adding -dFIXEDMEDIA I only see the bottom left corner on the page.Shonna
S
2

The problem was -dEPSFitPage it was fitting the page size to the .eps file size... using -dPDFFitPage (and skipping the mutually exclusive -dEPSCrop) solved my problem.

gs -dBATCH -dNOPAUSE -sPAPERSIZE=letter \
   -dPDFFitPage -q -sDEVICE=pdfwrite \
   -sOutputFile=out.pdf \
    file1.eps file2.eps
Shonna answered 30/1, 2013 at 2:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.