Tips & Tricks

Printing PDFs using JavaScript in Acrobat 6.0

January 21, 2004


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.

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Quick PDF Library

Get products to market faster with this amazing PDF developer SDK. Over 900 functions and an equally...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.