How to Print Different PDF Page Ranges and Copy Counts with Acrobat JavaScript
Question details
The user wants to use Acrobat JavaScript to automatically print specific PDF page ranges with varying copy counts and duplex settings.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an automated button in a PDF document to trigger complex printing tasks, where certain sections require single copies and others require multiple copies or different duplex modes.
- Observed behavior
- A single this.print() execution only accepts one NumCopies value and one DuplexType setting, preventing the user from assigning multiple copy counts across different page ranges simultaneously.
Ensure you have access to Adobe Acrobat Pro to edit form fields and execute JavaScript, and verify that your target printer supports the required duplex modes.
Create Separate Print Jobs for Different Copy Counts
Because each print call strictly processes one copy count and duplex setting, you must split your complex printing requirements into separate, sequential print jobs.
The Acrobat JavaScript API uses the PrintParams object to dictate how a document is printed. Properties like NumCopies and DuplexType apply to the entire print job defined in that instance. To apply different parameters to different pages, you must instantiate multiple PrintParams objects and execute them individually.
It is also critical to remember that Acrobat page indexes are zero-based. For example, if you wish to print page 9, the correct index in your code is 8.
Access your button's JavaScript action. Start by initializing the print parameters for your first batch of pages using var pp = this.getPrintParams();.
Assign the pages that only need to be printed once using a two-dimensional array of zero-based indexes. For example: pp.printRange = [[1, 7], [12, 31]];.
Specify the copy count with pp.NumCopies = 1; and configure the duplex setting if needed (e.g., pp.DuplexType = pp.constants.duplexTypes.DuplexFlipLongEdge;). Run the first job with this.print(pp);.
Below your first execution, initialize a second parameter object with var pp2 = this.getPrintParams();. Set the range for the pages you need copied twice (e.g., pp2.printRange = [[8, 11]]; for pages 9-12).
Set pp2.NumCopies = 2;, apply any required duplex modifications, and trigger the second print command with this.print(pp2);.

Manage and Print Your PDFs Easily with WPS Office
While Acrobat JavaScript requires advanced coding to configure complex print jobs, WPS Office provides an intuitive, user-friendly interface to manage page ranges, multiple copies, and duplex printing directly—without writing a single line of code.
- 1. Download and install: Download WPS Office Free and install it on your computer.
- 2. Open your document: Launch WPS PDF and open the document you wish to print.
- 3. Access print settings: Press Ctrl+P to open the comprehensive print dialogue box.
- 4. Customize and print: Manually select your custom page ranges, enter the number of copies required for each batch, and toggle duplex printing directly from the interface.

Frequently Asked Questions
Why is my Acrobat JavaScript printing the wrong pages?
Acrobat JavaScript relies on zero-based page indexing for the printRange array. If you configure your array using standard page numbers (e.g., [10, 15]), it will actually print pages 11 through 16. Always subtract one from the intended page numbers.
Can I apply different duplex settings within the same getPrintParams() object?
No. A single PrintParams object can only retain one DuplexType property. You must create separate print jobs for each section of the document that requires a different duplex setting.
Does the DuplexType property work on all printers?
The success of the DuplexType JavaScript command heavily depends on the selected printer and its driver capabilities. If the printer hardware or driver does not support the requested duplex mode, the command may be ignored or overridden by the printer's default settings.




