2 people found this helpful
Your way of doing it will work, but it's not very good because it means that the Print dialog will open not just when the file is opened, but each time the user views the first page of the file. For example, if you scroll to the second page and then back to the first the Print dialog will open again, using your method.
A better way is to embed a code at the doc-level, which will open the Print dialog only when the file is opened.
This can also be done as a part of an Action, in Acrobat Pro, and applied to multiple files at once.
Basically, all you have to do is create a new Action (via Tools - Action Wizard) with the following JS code (and a Save command), and then run it on your files:
It is possible to declare a variable that can be set to show that you script ran once and skips running it a second time.
The following script can be placed on the page open action.
// see if control variable exist;
ifItypeof bPrintUI == "undefined")
// does not exist so define it as false;
var bPrintUI = false;
// see if print ui has been opened
if(bPrintUI != true)
// it has not;
bPrintUI = true; // set to have been opened;
this.print(); // display print dialog;
If you place this only on the first page, the script will not run if the PDF is opened to another page.
Many thanks for your help. I've tried the following but unfortunately it doesn't seem to work.
1. I create an action
/* Set Print Dialog to open automatically */
I tried running the action on a single file as well as multiple files. In both cases when I re-open any of the files the print dialog doesn't automatically open?
Many thanks for your help!!
1 person found this helpful
You must use addScript not addscript.
Thank you, sorry a silly mistake : )
Its working now!
The only issue now is that the print dialog pops up for each document when the action runs on that document; so I have to click cancel before it will process the next document. I need to investigate if there is a way to stop the print dialog popping up whil the action is running ???
The question is whether or not that action will trigger the code at the moment you import the FDF file...
Unfortunately disabling JS in preferences didn't work.
I will look into the option of importing an FDF file to see if this will work. In the short term I'll put up with the print dialog popping up for each document as the action works through them. Thanks everyone for all your help!! HJ
Yeah, of course... My mistake. It can't work because you're using JS to embed the code, of course.
Another possible workaround is to add an if-condition that only executes the code if it's not the current date...