Hi Tom,
I appreciate your help with this.
I would like to add a javascript to a PDF file "programmatically" using Visual Basic. This javascript should get executed when the PDF is opened in a adobe viewer browser plugin. In other words, I'm looking for a coding equivalent of the following menu item sequence in Acrobat environment:
Page tab -> Page Properties -> Select Trigger:Page Open -> Select Action: Run a JavaScript and key in the following code: this.print();
All I want to achieve is to invoke the print dialog automatically when I open the PDF document in Adobe viewer.
To executed this from a VB program you'll need to use the JSO object, which is part of the Acrobat IAC. This is an ActiveX interface for Acrobat. All the documentation is here
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]
I'm not positive about this, but I do not think you will be able to detect a document open event from a VB program. I know you can't do it, at least not directly, from Acrobat JavaScript.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script