I'm displaying PDF file that are generated on-the-fly within a ASP page. The PDF generation (and download to the client) can take some time and I'd like to provide the user with some feedback (a loading message or something).
AFAIK there's no way to know when the PDF is viewed because the DOM events get triggered when the Adobe Reader plugin gets loaded (even though it's not displaying anything yet).
I noticed that there's a Javascript API for the plugin object that I could potentially use. I notivced a LoadFile
method on it but unfortunately it doesn't seem to do much.
Adobe's documentation is really useless. It talks of Javascript only as a plug-in writting language or as OLE interaction (and poorly).
Is there any documentation for the API and is it possible to know when the PDF has been loaded? It would be perfect if I could pass on a PDF stream to a PDF viewer of some sort.
Acrobat and Acrobat Reader let you adjust application behavior so that JavaScript executes within your desired level of security.
The JavaScript debugger in Acrobat lets you review your code line by line, set breakpoints, and inspect variables using the debugger dialog. To enable JavaScript Debugger, go to Edit > Preferences > JavaScript, and then select the Enable JavaScript debugger after Acrobat is restarted option.
Choose Edit > Preferences (Windows) or Acrobat / Acrobat Reader > Preferences (Mac OS). From the Categories on the left, select JavaScript.
A JavaScript action allows execution of JavaScript code embedded in the PDF document. Essential PDF supports adding JavaScript action to the PDF document in the following: Document level JavaScript action.
I've wanted to the same, found a page that may help you out. http://www.adobe.com/devnet/acrobat/javascript.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With