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

后端 未结 1 1377
长发绾君心
长发绾君心 2021-01-05 14:24

I\'m trying to use ghostscript to convert a .ps file to a series of .png files, largely because I don\'t have a tolerable ps viewer.

This is the command I\'ve used:<

1条回答
  •  没有蜡笔的小新
    2021-01-05 14:49

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

    0 讨论(0)
提交回复
热议问题