Almost a year ago I told you how to do “printing directly from Internet Explorer without a Print dialog“. I had my doubts about the security aspect of this option. It reminded me of “the old days” when kids would fax entire black pages (looping around a couple of A4 paper with some tape) to make your fax machine burn its thermic print head. With IE, you could possibly lure people to a bogus site, open an even more bogus (and very long) page and let the script print it all.
The people at Adobe must have had the same thoughts with their PrintAll function of the Adobe pdf.ocx control. It let’s you print an entire PDF document without even a Print dialog. A customer of mine wanted this behavior and it worked. Note the past tense. It worked in 5.0, but not in any version after 5.0.5 (meaning 5.1, 6.0 and 7.0). For those versions you get this dialog:
As long as you don’t touch the checkbox, you are ok. The control will prompt and only when you click “Yes” will it print all pages. As soon as users touches the checkbox, they are toast. It will print after they click “Yes”, but any other time after that the control will not prompt anymore. No promptie, no printie. Shoot.
How come? Well, after the checkbox has been checked, a registry key is set at HKEY_CURRENT_USERSoftwareAdobeAcrobat Reader5.0AVAlertcCheckboxcEWH. A key called iWarnScriptPrintAll is created and given the value 1. This will stop the dialog from appearing. But unfortunately, no dialog means that no print command is issued, just to be sure I guess. So, the checkbox description is right: do not show again. It doesn’t say “Remember my choice”, as often is the case.
You can reset the value of iWarnScriptPrintAll to 0 (zero), which will cause the dialog to appear again after the process AcroRd32.exe has been restarted. But selecting the checkbox will print once, and the warning dialog will not appear until AcroRd32.exe is stopped again. You do not have to set the registry key again for this to happen.
This is a real bummer, but I have found a dirty (!) way to solve it in some circumstances (with a little help from here). If you can resort to using Adobe Acrobat Reader 5.1, you can save the EWH32.api file from version 5.0.5 and overwrite the 5.1 version of it. Now, remember: this is nasty stuff, and no guarantees on stability or support, but it will get rid of the Script Warn dialog and do the direct printing again on a call to PrintAll.
Any suggestions for a nice solution are very welcome.