本文介绍了获取PostScript文档的页面大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过简单的程序或shell脚本获取PostScript文档每一页的页面大小。
I want to get page size of each page of a PostScript document in a simple program or shell script.
是否有任何程序或库可以获取该页面大小。 (类似于pdfinfo,但处理PostScript)
Is there any program or library that can get the page sizes. (Like pdfinfo, but dealing with PostScript)
推荐答案
毫无疑问,有一些程序可以使用,但是您可以尝试使用Ghostscript:
No doubt, there's some program for that, but you can try using Ghostscript:
gs -q -sDEVICE=nullpage -dBATCH -dNOPAUSE \
-c '/showpage{currentpagedevice /PageSize get{=}forall showpage}bind def' \
-f test.ps
但是,然后您可能需要过滤掉所有警告或DSC注释。例如。我发现的测试文件之一给了我这个:
But then you may need to filter out any warnings or DSC comments. E.g. one of test file I found gave me this:
%%[ ProductName: GPL Ghostscript ]%%
(Warning: Job contains content that cannot be separated with on-host methods. Th
is content appears on the black plate, and knocks out all other plates.)
595.28
841.89
%%[Page: 1]%%
%%[LastPage]%%
放入一些重新定义的显示页面
过程中添加标记可能会有所帮助。
Putting some markers into your redefined showpage
procedure may be helpful.
这篇关于获取PostScript文档的页面大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!