在网络上打开大型pdf文件 [英] opening a large pdf files on web

查看:122
本文介绍了在网络上打开大型pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个27MB的pdf文件,该文件托管在网络中.当我尝试打开它时,需要花费一些时间才能将其打开.所以有什么办法可以让我快速查看这个大的pdf文件.我猜有一些设置,在某些页面下载后,我们可以查看文件的页面一次. 对此的解决方案将受到高度赞赏

I have a 27MB pdf file which is hosted in web. When I try to open it, it takes times to open it. So Is there any way where I can view this large pdf file a bit fast. I guess there are some settings where we can view the pages of the file once after some pages are downloaded. ANy solution to this would be highly appreciated

推荐答案

您需要对PDF进行网络优化".技术上更正确的术语是使它们线性化":

What you need to do to your PDF is to make them "web optimized". The technically more correct term is to make them "linearized":

  • Acrobat + Distiller和许多其他工具可以做到这一点.
  • Ghostscript还附带了一个附加的PostScript编写的名为pdfopt.ps的帮助程序实用程序,可以执行此操作.只需运行:
    gs -q -dNODISPLAY -P- -dSAFER -dDELAYSAFER -- /path/to/pdfopt.ps input.pdf optimized.pdf,或者如果您使用的是Windows:
    gswin32.exe -q -dNODISPLAY -P- -dSAFER -dDELAYSAFER -- c:/path/to/pdfopt.ps input.pdf optimized.pdf
  • Acrobat + Distiller and a lot of other tools can do that.
  • Ghostscript also ships an additional PostScript-written helper utility named pdfopt.ps which can do this. Simply run:
    gs -q -dNODISPLAY -P- -dSAFER -dDELAYSAFER -- /path/to/pdfopt.ps input.pdf optimized.pdf, or if you are on Windows:
    gswin32.exe -q -dNODISPLAY -P- -dSAFER -dDELAYSAFER -- c:/path/to/pdfopt.ps input.pdf optimized.pdf

通常pdfopt.ps应该与Ghostscript一起安装在安装路径的lib/子目录中.如果不是,则可以下载pdfopt.ps .

Normally pdfopt.ps should be installed together with your Ghostscript in the installation path's lib/ subdirectory. If not, you can download pdfopt.ps from the Ghostscript Git repository.

Linearization在内部重新组织PDF,以便将其内部PDF对象的ToC(从技术角度:其" xref 表")(的副本)放在靠近PDF开头的位置.文件(而不是结束文件)以及其他一些更改.

Linearization re-organizes the PDF internally, so that (a copy of) its internal ToC of PDF objects (in technical terms: its "xref table") is put close to the beginning of the file (instead of its end), plus some more changes.

这样,符合规格的PDF阅读器将能够在文件的其余部分加载之前开始呈现第一页.如果您正在使用基于HTTP的协议通过Web访问PDF,甚至可以跳至最后一页并在下载中间页之前对其进行查看.但是,然后,Web服务器需要支持HTTP字节范围"请求(否则,即使对于线性化的PDF也无法使用).

That way, a spec-conforming PDF reader will be able to start rendering the first page before the rest of the file has been loaded. It will even be possible to jump to the last page and view it before the middle pages are downloaded, if you are accessing the PDF over the web using HTTP-based protocols. But then, the web server is required to support the HTTP "byte range" requests (otherwise this will not work even for linearized PDFs).

您可以在官方PDF-1.7 ISO标准规范中阅读有关PDF线性化的更多详细信息,

You can read some more details about PDF linearizations in the official PDF-1.7 ISO standard spec, available on the Adobe website

  • (规范性)附件F中的线性化PDF" (从第683页开始)和
  • 在其(参考性)附件G中,线性化的PDF访问策略" ,始于第703页.
  • in its (normative) Annex F, "Linearized PDF", starting on page 683, and
  • in its (informative) Annex G, "Linearized PDF Access Strategies", starting on page 703.

线性化PDF的示例可在此处找到

自Ghostscript版本9.07开始,通过在命令行中添加以下开关,可以直接生成线性化(经过网络优化")的PDF输出(无需上面概述的两步方法):

Since release 9.07 of Ghostscript, linearized ("web optimized") PDF output can be generated directly (without the 2-step approach outlined above) by adding the following switch to the commandline:

-dFastWebView=true

由于pdfopt.ps文件现在是冗余文件,因此已将其从当前的Ghostscript源存储库中删除.

Since the pdfopt.ps file is now redundant, it has been removed from the current Ghostscript source repository.

这篇关于在网络上打开大型pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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