Expand my Community achievements bar.

Print button issues.

Avatar

Level 4

Hello everyone,

In order to 'flatten' our pdf forms so that they cannot easily be modified, we have decided to print all of our completed forms to a virtual .pdf writer. Now, we could have all of our users click file-->print-->select 'cutePDF Writer' from the printer drop-down-->hit OK-->Type in a file name for the new .PDF-->hit OK... but I was hoping that I could make their lives easier by adding a button to do most of this for them.

After scowering the depths of the internet, I found this script that I've added to the click event of a button:

var objPrintParams = event.target.getPrintParams();
objPrintParams.interactive = objPrintParams.constants.interactionLevel.silent;
objPrintParams.printerName = "cutePDF Writer";
event.target.print(objPrintParams);

This effectively handles everything up to 'Type in a file name for the new .PDF' step... but there are some issues.

The first is that some of our users may not have cutePDF installed. As it is, the script doesn't throw an error if the printer does not exist. Without the printer installed, clicking the button seems to have no effect. Both pre- and post-print events fire as if the printing worked, even though it didn't. I would like to have a helpful message for the user, but I can't think of a way to check if it failed. If I could get a list of printers, I could check it before trying to print... but event.target.printerNames(); doesn't work, and that was the only thing that i could find to list printer names.

The second issue is that a message is displayed to inform the users the the document is trying to print. "This document is trying to print..." I get that this is a security measure, but the user is pressing a button called print, and having to click a second time may get annoying. Additionally, if they click no by accident, this response is stored until they restart reader... clicking the print button again does nothing.

Ultimately, I'd like to get rid of this message... but if I can't do that, I'd like for it to show each time that the user presses it, both for consistancy, and to allow them to change their minds without having to close out reader, losing all of the filled fields that they entered.

I know that this might be asking the impossible, but I would appreciate any help with this.

- Scott

0 Replies