Priyank
Priyank

Reputation: 14387

Rendering PDF on WebPage

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:

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

Cheers

Upvotes: 4

Views: 5764

Answers (3)

Prof. Falken
Prof. Falken

Reputation: 24867

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?

Upvotes: 0

Peter Eysermans
Peter Eysermans

Reputation: 489

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

Upvotes: 3

Fabrizio Accatino
Fabrizio Accatino

Reputation: 2292

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.

Upvotes: 1

Related Questions