How to Set Duplex Printing, Copies, and Collation with Acrobat JavaScript
Question details
The user needs to learn how to configure automated PDF printing options such as page ranges, number of copies, duplex printing, and page fitting using Acrobat JavaScript.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Automating specific print jobs with predefined settings using a JavaScript API.
- Observed behavior
- Requires a script utilizing the PrintParams object to set parameters before triggering the print action.
Ensure you have access to the JavaScript console or document-level scripts in your PDF editor, and verify that your target printer hardware supports duplex (two-sided) printing.
Use the PrintParams Object to Configure Print Settings
Utilize the getPrintParams() function in Acrobat JavaScript to define specific print options before executing the print command.
The Acrobat JavaScript API provides the PrintParams object, which allows you to programmatically control the print dialog and output settings without manual user intervention.
Open the JavaScript console in your PDF editor and define the parameters by typing: var pp = this.getPrintParams();
Define the starting page, ending page, and the number of copies by adding: pp.firstPage = 1; pp.lastPage = 3; pp.NumCopies = 3;
Set the duplex printing mode and page fitting options by adding: pp.DuplexType = pp.constants.duplexTypes.DuplexFlipShortEdge; pp.pageHandling = pp.constants.handling.fit;
Send the document to the printer using your defined parameters by adding the command: this.print(pp);

Easily Configure Duplex, Copies, and Collation in WPS PDF
If you want to skip complex JavaScript coding, WPS Office provides an intuitive interface to easily configure advanced PDF printing options like duplex printing, collating, and page sizing in just a few clicks.
- 1. Open your PDF: Launch WPS Office and open the PDF document you want to print.
- 2. Access the print menu: Click on 'Menu' in the top-left corner and select 'Print', or press the shortcut 'Ctrl + P'.
- 3. Set copies and collation: In the Print dialog, enter your desired number of copies and check the 'Collate' box if needed.
- 4. Configure duplex printing: Under 'Print Handling', select 'Print on both sides' and choose whether to flip on the long or short edge.
- 5. Print the document: Click the 'Print' button to instantly send your fully configured document to the printer.

Frequently Asked Questions
Can I print a PDF silently using JavaScript without displaying the print dialog?
Yes, you can suppress the print dialog by setting 'pp.interactive = pp.constants.interactionLevel.silent;' in your PrintParams object before calling 'this.print(pp);'. Note that application security settings may still block silent printing.
How can I display a pop-up confirming that the document was sent to the printer?
You can display a confirmation dialog immediately after your print command by adding 'app.alert("Document sent to printer.");' to the end of your JavaScript code.
Where can I find the official documentation for the Acrobat JavaScript API?
You can find the complete documentation for the PrintParams object and other JavaScript APIs on the official Adobe developer portal under the Acrobat DC SDK documentation section.
What does DuplexFlipShortEdge mean in PDF printing?
It instructs the printer to flip the pages along the short edge of the paper when printing double-sided. This setting is typically used for landscape-oriented documents like calendars or presentation slides.




