These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Invoke print doalog automatically when opening a PDF

bcs_aa
Registered: Jun 7 2007
Posts: 2

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.

My Product Information:
Acrobat Standard 7.0.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Look in the Acrobat JavaScript Reference at the methods for the Doc Object. You'll find a function named "SetPageAction". This is what you want.

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