views:

125

answers:

2

Hi.

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:

  • Show a progress bar until the PDF is actually displayed. We couldn't find an event which is triggered and can be used to find out if pdf is visible now. This lacking doesn't let us decide when to stop showing progress bar/spinner
  • OR lazy load the PDF such that it gets displayed as soon as first page gets loaded. With that ateast user will have a visual indication as to something is happening. We couldn'find anything in pdf object that lets us do a lazy load.
  • User alternative pdf rendering api; this is a low priority as we already have complete code in place; but in an event of first 2 alternatives not being met; we'd have to consider this option. So please feel free to suggest.

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

Cheers

A: 

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.

Fabrizio
+1  A: 

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

PeterEysermans