3 Replies Latest reply on Sep 20, 2012 10:15 PM by Menaga01

    Access Windows Registry for Silent PDF Printing

    Menaga01

      Hi All,

       

      I am trying to print a form (created in Livecycle Designer ES2) silently to PDF upon the click of (javascript) button on the form. I have Win XP and Acrobat 9 Pro. I feel close to achieving the goal however after some time and effort I am not sure the approach I am leaning toward is possible. So far I have the following:

       

      1. By following the Acrobat SDK / JS for Acrobat API reference I have been able to use the PrintParams object to set print properties including the page(s) to print and printer selection, however the code only works if, for the fileName property, I specify file type as postscript (.ps), when .pdf is used it does not work. JS used on click_event of my form button:

       

      var myDoc = event.target;

      var pp = myDoc.getPrintParams();

      pp.interactive = pp.constants.handling.none;

      pp.fileName = "/C/Test.ps";    

      pp.printerName = "Adobe PDF";

      pp.firstPage = 2;

      myDoc.print(pp);

       

      This works however I really want the filename to be something like "/C/Test.pdf" which does not work

       

      2. I have since learned that the windows registry...Acrobat Distiller\PrinterJobControl can be manually modified so Adobe knows where to send the output file:

       

      Registry folder: HKEY_CURRENT_USER\Software\Adobe\Acrobat Distiller\PrinterJobControl

      I created new string under above folder with properties below:

           String value name: C:\Program Files\Adobe\Acorbat 9.0\Acrobat\Acrobat.exe

           String value data: C:\Test.pdf

       

      The approach in 2. works in combination with the code in 1. (without the pp.filename property being specified) but the registry string would need to be manually created each time before printing which is not practical.

       

      Is anyone able to advise whether or not it is possible to create a new registry string using Javascript (looks like there are quite a few VBA examples of this for use with MSAccess) from acrobat? or maybe another way to print to a specified file to PDF using JS from Acrobat?

       

      Any help or advice is much appreciated,

      Kind regards,

       

      Adam

        • 1. Re: Access Windows Registry for Silent PDF Printing
          Bernd Alheit Adobe Community Professional & MVP

          With Acrobat Javascript it is not possible to create a new registry string.

          1 person found this helpful
          • 2. Re: Access Windows Registry for Silent PDF Printing
            gkaiseril MVP & Adobe Community Professional

            So many security issues for the general public.

             

            You path name is not considered a "Safe Path", as it is a root directory and since many systems have system control files in the root directory, Adobe has blocked the access to this directory for security reasons.

             

            "Silent Printing" is possible to printer over the Internet and is considered a security risk, but you can write a special application level JavaScript function that could provide this on a single system.

             

            "Save as .."  is also considered a security risk and blocked except when a special application user written function is used.

             

            See the Acrobat JavaScript API Reference for more information about safe paths and silent printing and saving along with other restricted actions.

            1 person found this helpful
            • 3. Re: Access Windows Registry for Silent PDF Printing
              Menaga01 Level 1

              Thanks for your replies Bernd & GKaiseril,

               

              I had hoped creating a new string was possible but can appreciate that it isn't possible for security reasons. I will look more into safe Paths, silent printing and saving etc. in the API reference as suggested.

               

              Note: I had actually used the 'filename' path for my desktop (i.e. "/C/Documents and Settings/Adam/Desktop/Test.ps" not "/C/Test.ps") but for some reason chose to post the latter not appreciating the significance.

               

              Thanks again,

               

              Adam