使用GhostScript获取页面大小 [英] Using GhostScript to get page size

查看:119
本文介绍了使用GhostScript获取页面大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用GhostScript获取页面大小(例如从PDF文档页面)?我已经看到了"bbox"设备,但是它返回的是边界框(每个页面都不同),而不是PDF页面的TrimBox(或CropBox). (有关信息,请参见 http://www.prepressure.com/pdf/basics/page_boxes 关于页面框.)还有其他可能性吗?

Is it possible to get the page size (from e.g. a PDF document page) using GhostScript? I have seen the "bbox" device, but it returns the bounding box (it differs per page), not the TrimBox (or CropBox) of the PDF pages. (See http://www.prepressure.com/pdf/basics/page_boxes for info about page boxes.) Any other possibility?

推荐答案

与此同时,我发现了另一种方法.这个仅使用Ghostscript(按您的要求).无需其他第三方实用程序.

Meanwhile I found a different method. This one uses Ghostscript only (just as you required). No need for additional third party utilities.

此方法使用了一个用PostScript编写的小帮助程序,该程序随附了Ghostscript的源代码.在 toolbin 子目录中查找pdf_info.ps文件.

This method uses a little helper program, written in PostScript, shipping with the source code of Ghostscript. Look in the toolbin subdir for the pdf_info.ps file.

所包含的评论说,您应该像这样运行它,以便列出使用的字体,使用的介质大小

The included comments say you should run it like this in order to list fonts used, media sizes used

gswin32c -dNODISPLAY ^
   -q ^
   -sFile=____.pdf ^
   [-dDumpMediaSizes] ^
   [-dDumpFontsUsed [-dShowEmbeddedFonts]] ^
   toolbin/pdf_info.ps

我确实在本地示例文件上运行了该文件,但命令行参数仅要求媒体大小(不要求使用的字体).结果如下:

I did run it on a local example file, with commandline parameters that ask for the media sizes only (not the fonts used). Here is the result:

C:\> gswin32c ^
      -dNODISPLAY ^
      -q ^
      -sFile=c:\downloads\_IXUS_850IS_ADVCUG_EN.pdf ^
      -dDumpMediaSizes ^
      C:/gs8.71/lib/pdf_info.ps


  c:\downloads\_IXUS_850IS_ADVCUG_EN.pdf has 146 pages.
  Creator: FrameMaker 6.0
  Producer: Acrobat Distiller 5.0.5 (Windows)
  CreationDate: D:20060817164306Z
  ModDate: D:20060822122024+02'00'

  Page 1 MediaBox: [ 595 842 ] CropBox: [ 419.535 297.644 ]
  Page 2 MediaBox: [ 595 842 ] CropBox: [ 297.646 419.524 ]
  Page 3 MediaBox: [ 595 842 ] CropBox: [ 297.646 419.524 ]
  Page 4 MediaBox: [ 595 842 ] CropBox: [ 297.646 419.524 ]
  [....]

这篇关于使用GhostScript获取页面大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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