views:

1298

answers:

2

How to interact with embedded PDF documents in iframes through JavaScript?

  • Is it possible?
  • Is it possible in every main browsers?

if "yes", how can I...

  • ...know that the document finished loading?
  • ...trigger the print dialog?
  • ...configure the zooming?
  • ...configure the toolbars?
+1  A: 

It is possible, but you will need to wrap the PDF viewer in a COM Component (if its not already), and include it in the form with the HTML Object tag. From there you should be able to manipulate the com wrapper (and indirectly the pdf viewer) via javascript to do the actions.

Since you will be wrapping and serving the viewer component (check your licensing), you will have control of what functionality that is present (also depending on the capabilities of the viewer component).

An example of how to include the com stuff in object tags is here...http://www.activexpowupload.com/quickstart/util/srcview.aspx?path=/Examples/ActiveXPowUpload/SourceExplorer/SimpleUpload.src

Make no mistake, this is going to be a LOT of work and will probably drive you crazy. Also since you control the viewing component you are not going to be dependent on whatever the user has installed.

As a side note, PDF files served on the web should be linearized - the bytes structured so that the pages are streamed to the user sequentially. This way a whole document does not have to be recieved before the first few pages are displayed in the browser. This may interfere with your wanting to know when the file is complete.

StingyJack
A: 

StingyJack's comment sounds like it would only work in IE, unless I'm mistaken.