Fit to page size in ghostscript (with a possibly corrupt input)

依然范特西╮ 提交于 2019-11-30 20:27:43
KenS

-dEPSCrop and -dEPSFitPage are mutually exclusive:

  • One crops the EPS to the BoundingBox specified in the comments.
  • The other scales up the EPS from the %%BoundingBox specified in the PS file's internal comments to fit the current media.

You can't really use both at the same time.

The file can't be an EPS file anyway, because you can't have multiple pages in an EPS file. So actually neither switch will have any effect (as you've discovered).

Either the PostScript requests a media size using setpage or setpagedevice, or it just uses whatever the currently set media is. My guess is that its just using the current media. Try setting -sPAPERSIZE=a4 and -sPAPERSIZE=letter.

If that works then the program does not request a media size. If it has no effect, then set -dFIXEDMEDIA in addition which will ignore subsequent requests to change the media size.

That should allow you to specify the correct media size, if you don't know what the media size should be then you can use the Ghostscript -sDEVICE=bbox device to find out.

Lastly, Ghostscript has a rudimentary display device which you can use to view the rendered output without first going to a PNG.

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