3 Replies Latest reply on Apr 16, 2012 7:25 PM by Iblio

    Print PDF document with printer's name and date/time of print




      I'm pretty new to this...


      I have a PDF document and when I print it, I want the printer's name and the date/time of print to be showed on the printer's output.


      I have several printers (some local and some on network) and don't necessarly use the default one. I would like the name of the printer used, to be printed on the document.

      With var h = this.getField("Printer"); h.value = app.printerNames; I'm able to get the list of all printers available but I just need the one used.


      For the date/time, using var f = this.getField("Today"); f.value = util.printd("mmm/d/yyyy", new Date()); gives me the date/time of when the document is open, not when the document is printed. (or maybe I'm missing something?)


      I guess the date/time issue is not the major one as there is usually not much difference between the time you open the document and the time you print it.

      I'm more interested in the printer's name.

      I use Acrobat Pro 9 to edit my PDF document.


      Can anyone help me please?


        • 1. Re: Print PDF document with printer's name and date/time of print
          try67 MVP & Adobe Community Professional

          You can only know the printer's name if you set it yourself using the

          PrintParams object. If the user selects the printer themselves, a script has

          no way of knowing what it was.

          Regarding the date, you need to move your code to the WillPrint event of the


          • 2. Re: Print PDF document with printer's name and date/time of print
            gkaiseril MVP & Adobe Community Professional

            The printer name is a property of the PrintParams object. This property is updated before the PDF is sent to the printer and the name of the selected printer from the Print UI is available during the "Will Print' event.


            In the "Will Print" document action you can use:


            var pp = this.getPrintParams();
            this.getField('PrinterName').value = pp.printerName;

            • 3. Re: Print PDF document with printer's name and date/time of print
              Iblio Level 1

              This project was left aside for a while... but it's now finished!


              Thank you for the answers. It was helpful.



              Here is a step-by-step of what I did (using Adobe Acrobat 9.5.1):


              • Open PDF document in Acrobat
              • Select Forms -> Add or Edit Fields
              • Add two text fields: one called "Today" for the date and one called "Printer" for the printer name
              • Close the form editing
              • Select Advanced -> Document Processing -> Set Document Actions...
              • Then select Document Will Print and Edit
              • Paste the following code:

              var f = this.getField("Today"); f.value = util.printd("dd mmm yyyy - HH:MM", new Date());

              var pp = this.getPrintParams();

              this.getField("Printer").value = pp.printerName;

              • Save your PDF
              • Enjoy!


              The date and printer name field will be automatically updated when you print the document!

              1 person found this helpful