Using ghostscript as x11 viewer (gs x11 viewport positioning)?

非 Y 不嫁゛ 提交于 2019-12-04 16:06:07

No, AFAIK, Ghostscript itself doesn't provide what you want (a 'viewport'). That's exactly what the ghostview and gv GUI frontends are for.

Ghostscript treats the x11 device (almost) as a print page output device, and print pages do have fixed sizes, and you cannot move a 'viewport' of the page image on them either -- unless you do re-print them with a different setting: and this is then where a differently valued -c "<</PageOffset [-150 133]>> setpagedevice" parameter comes into play...

sdaau

OK, thanks to (#277826) ghostscript - How can I shift page images in PDF files more to the left or to the right?, I can see there is possibility to use postscript's PageOffset command/operator to achieve offset/displacement of the viewport; thus the following command line can be used:

gs -sDevice=x11 -g500x500 -r150x150 -dFirstPage=3 -c '<</PageOffset [-150 133]>> setpagedevice' -f fontspec.pdf

Note that, unlike the command line in OP - here you must use the -f switch to specify the input file here - if not, the command will fail with: Error: /undefined in fontspec.pdf.

Otherwise, the output looks like this:

So this is nice to know - but I'm still curious if ghostscript doesn't already have some default switches, that would allow this viewport offset/repositioning thing...

Hope this helps someone,
Cheers!

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