使用Ghostscript作为x11查看器(gs x11视口定位)? [英] Using ghostscript as x11 viewer (gs x11 viewport positioning)?

查看:110
本文介绍了使用Ghostscript作为x11查看器(gs x11视口定位)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经了解 Ghostscript前端观看者;但我想知道gs本身如何用于查看PDF文档?

我最接近的是将x11窗口明确指定为输出设备,通过-g指定窗口的宽度和高度,并通过-r指定光栅化分辨率;或者,像这样的命令行:

gs -sDevice=x11 -g500x500 -r150x150 -dFirstPage=3 fontspec.pdf

...结果类似于:

...实际上,这一切都很好-除了它从左下角开始;而且这里没有键盘快捷键(据我所知)可以移动视口或执行某些缩放操作.

我知道ghostscipt可能没有用于导航x11窗口输出的鼠标/键盘交互,因为类似的东西是为gv这样的前端查看器保留的.因此,在ghostscript中(对我而言)最接近的是-如何呈现页面的特定区域?已经通过-d-r指定了最重要的参数-例如,我只想在查看时指定一个与0x0不同的点(例如,x = 100 y = 100)作为左下角.

(换句话说,我想对ghostscript说:显示document.pdf的第3页,在左下角x,y =的500x500窗口中以150x150光栅化. 100,100 ).

如何在ghostscript中完成此操作?是否有用于此的命令行开关-或一旦加载了ghostscript,就必须在终端中使用postscript语言命令吗?

在此先感谢您的回答,
干杯!

解决方案

否,AFAIK,Ghostscript本身无法提供您想要的内容(视口").这正是ghostview和gv GUI前端的用途.

Ghostscript将x11设备(几乎)视为打印页面输出设备,并且打印页面的尺寸确实固定,并且您也不能在其上移动页面图像的视口"-除非您重新打印它们具有不同的设置:然后这是一个具有不同值的-c "<</PageOffset [-150 133]>> setpagedevice"参数起作用的地方...

I already know about Ghostscript front end viewers; but I was wondering how gs itself could be used for viewing PDF documents?

The closest I could get to, is to specify explicitly x11 window as output device, specify width and height of the window via -g, and specify rasterization resolution via -r; or, a command line like this:

gs -sDevice=x11 -g500x500 -r150x150 -dFirstPage=3 fontspec.pdf

... which results with something like:

... which is, in fact, all good - except, it starts at lower left corner; and there are no keyboard shortcuts (as far as I can see) here to move the viewport, or to perform some zooming.

I'm aware that ghostscipt probably doesn't have mouse/keyboard interaction for navigating a x11 window output, given that something like that is reserved for front-end viewers like gv. So, the closest thing to that (for me) in ghostscript would be - how to render a specific region of a page? Via -d and -r the most important parameters are already specified - I'd just want to, say, specify a different point than 0x0 (say, x=100 y=100) as a lower left corner when viewing.

(In other words, I'd like to say to ghostscript: show page 3 of document.pdf, rasterized at 150x150, in a window of 500x500, starting from lower-left corner x,y=100,100).

How can this be done in ghostscript? Are there command line switches for that - or would one have to use postscript language commands in terminal, once ghostscript has loaded?

Many thanks in advance for any answers,
Cheers!

解决方案

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

这篇关于使用Ghostscript作为x11查看器(gs x11视口定位)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆