Answered
Does anyone know if it would it be possible to use Javascript to listen for certain user click events, such as Open, Close, and Print, and immedately make a web service call to record information about the PDF being used.
If it's possible, I see this being a great way to get real-time usage of our PDF library.
Any feedback on this would be appreciated.
Thanks in advance.
Merritt
Actually, it's a bit impractical all the way around, but there is something you can do, which is to do a "submitForm()" call on the WillClose. The submitForm cannot be done silently. If it's fast the user won't see what's going on, but if it's slow the user will see the wait dialog. If there is not connection or a problem getting to the server scripts Acrobat will popup an error message. And there is no direct way in Acrobat JS to detect a valid connection. So it would be bad to try and do the submit in more than one place. Otherwise it could make the document less than usable.
Ok, now here's how you do it. First, add code to all the events you want to detect to build up a data structure of all the information you want. Do this in a document level variable. On the WillClose event convert this info into an XMLData object and then pass this into a "doc.submitForm()" function. You'll need a server script to recieve this data and then do something with it. The Server script will need to pass something back to Acrobat. The best thing to do might be to return a very simple FDF file. The big advantage with the FDF is that is can contain JavaScript that's run by Acrobat immediatly. I've used this technique to give the user a useful message. Not so different than a web service.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script