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

送分小仙女□ 提交于 2019-12-06 08:55:38

问题


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.


回答1:


-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)




回答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


来源:https://stackoverflow.com/questions/14595521/how-to-set-the-physical-size-of-pdf-pages-with-ghostscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!