我需要从 postscript 或 pcl 文件中确定文档页面信息。最好使用 Java,但 Ghostscript/Ghostpcl 也一样好。
我试图获得以下信息:
页面颜色
This can be achieved with ghostscript/ghostpcl using the device called inkcov.
PostScript
gswin64c.exe -dNOPAUSE -dBATCH -sDEVICE=inkcov -o- input.ps
PCL6
gpcl6win64 -dNOPAUSE -dBATCH -sDEVICE=inkcov -o- input.pcl
页面大小
There is a device called bbox which gives me the boundary box per page for PostScript or PCL6 documents
PostScript
gswin64c.exe -dNOPAUSE -dBATCH -sDEVICE=bbox -o- input.ps
PCL6
gpcl6win64 -dNOPAUSE -dBATCH -sDEVICE=bbox -o- input.pcl
但最终边界框是页面大小的不准确近似值。我检查了以下帖子,但该解决方案似乎不适用于我的 ghostscript 9.5 版 获取 PostScript 文档的页面大小