Rendering PDF on WebPage

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 15:41:44

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...

See: http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html

Option 3:

I had a similar situation. My pdfs were more big (100 MB or more). I used Ghostscript to create jpeg/png previews. The process is very cpu intensive and required disk access. But the users were very happy: they could preview very big pdf pages in few seconds.

Nowadays, browsers (and CPUs!) are powerful enough to render PDF using nothing but Javascript, and there are projects taking advantage of that.

Notably https://mozilla.github.io/pdf.js/

As for lazy load, it appears you can display the first page of a document before it has loaded: PDF JS - Lazy load?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!