7 Replies Latest reply on Sep 23, 2014 2:25 PM by try67

    Clicking A Button To Print Silently Using Adobe PDF Printer

    Shawnny Canuck Level 1

      Hello all,


      I am looking for some help with JavaScript in relation to creating a button that when clicked the opened file is printed silently using the Adobe PDF printer. I know what you are thinking why would you want to print a PDF file to a PDF file? The files are active forms and I have tried endless flatten solutions and I keep getting errors related to security or digital signatures that prevents the files from being modified. The only solution I have found is using the Adobe PDF printer and saving the file again. These are highly sensitive files and they need to be finalized.  Ultimately, I would like the user to click the button and the PDF is printed to the same directory with a 1 added to it but if that is not possible or for simplicity I would be happy with a simple print to the desktop using the same name. I have very little knowledge with JavaScript and using some examples from the internet this is what I have come up with so far. Any help would be greatly appreciated.


      app.addToolButton({
         cName: "flattenactiveformBtn", // A name for your button
         cExec: "customsilentprint()", // Function to call
         cLabel: "Flatten Active Form", // The Text on the Button
      });

      function customSilentPrint(){
         var pp = getPrintParams(); // Get printing parameters
         pp.interactive = pp.constants.interactionLevel.automatic; // Do not prompt user
         pp.printerName = 'Adobe PDF'; // Set printer name
         this.print(pp); // Print
      }