Printing PDFs using JavaScript in Acrobat 6.0

Included in Acrobat 6.0 is a new JavaScript object that provides more feature-rich printing capabilities from Acrobat JavaScript. This object is known as the printParams object. It should also be noted that this object is not supported in earlier (pre v6.0) versions of Acrobat and Reader, and that some of these properties are only available with the full version of Acrobat 6.0, and not the free Reader.

The way you use the printParams object is that you first must retrieve the object by using the doc.getPrintParams() method that returns the object.

var objPrintParams = this.getPrintParams();

Now that you have the printParams object stored in the objPrintParams variable, properties of the object can be set. A full list of these properties can be found in the Acrobat JavaScript Reference Guide, however we’ll mention a few of these here.

  • interactive: Determines the level of interaction between the user and the print job. Set through the constants object.
  • printerName: Allows a specific printer to be selected to print to.
  • pageSubset: Can choose to print all pages, or all even/odd pages.
  • printContent: Choose whether to print just the document content, document content *and* comments or to only print the contents of just the form fields.

Here shows an example of setting the above properties and printing the PDF document.

var objDoc = this;
var objPrintParams = doc.getPrintParams();

// Set so no dialog box is displayed at all to the user during printing
objPrintParams.interacitve =

// Select which printer to print to
objPrintParams.printerName = 'Canon Bubble-Jet BJC-6000';

// Print only odd pages
objPrintParams.pageSubset = objPrintParams.subsets.odd;

// Print both content and comments
objPrintParams.printContent =

// Print the PDF using properties just set with printParams object

As mentioned above, there are a number of additional properties available in the printParams object — the Acrobat JavaScript Reference should be consulted for more information.

You May Also Like

About the Author: Planet PDF Team

Leave a Reply