在网页上渲染PDF [英] Rendering PDF on WebPage

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

问题描述

我们正尝试使用 pdfobject javascript API在网络浏览器中加载pdf文件.目前,我们尝试显示的pdf大小接近10MB.这会导致在网页上显示PDF的时间过长;下载完整的PDF.

We are trying to load a pdf file in web browser using pdfobject javascript api. Currently the size of the pdf's that we are trying to display is close to 10MBs. This creates a long delay in displaying a PDF on web page; while the complete PDF gets downloaded.

我们需要通过以下两种方法之一来消除这种滞后:

We need to remove this lag by achieving either of the alternatives:

  • 显示进度条,直到实际显示PDF.我们找不到触发的事件,可以用来发现pdf现在是否可见.这种缺乏并不能让我们决定何时停止显示进度条/微调框
  • 或延迟加载PDF,以便在加载第一页后立即显示它.借助该ateast,用户将对发生的事情有直观的指示.我们无法在pdf对象中找到让我们做延迟加载的任何内容.
  • 用户替代的pdf渲染API;这是低优先级的,因为我们已经有完整的代码;但是如果没有满足前2个替代方案;我们必须考虑这个选项.因此,请随时提出建议.

关于如何使用户交互更加直观或愉悦的任何其他想法;会受到欢迎的.

Any other ideas as to how user interaction can be made more intuitive or pleasant; would be welcome.

欢呼

推荐答案

您可以考虑使用Google文档之类的东西来向用户显示PDF.我不知道这是否适用于您的情况.您可以使用它来显示外部PDF(未保存在Google文档中的PDF文件).它带有内置的进度条,因此即使加载时间很长...

You might consider using something like Google Documents to show your PDF to your users. I don't know if it is applicable to your situation. You can use it to show external PDFs (PDF files not saved in Google Documents). It comes with a progress bar built-in so even if the loading takes long...

请参阅: http://googlesystem.blogspot.com /2009/09/embeddable-google-document-viewer.html

这篇关于在网页上渲染PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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