How to Automatically Print Multiple Different Copies of a PDF
Question details
The user needs to automate a specific PDF printing workflow that generates three distinct outputs: one full document in color, one full document in grayscale, and one grayscale copy of only the last page.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Automating repetitive and complex print jobs for a single PDF document to save time and avoid manual print dialog configuration.
- Observed behavior
- The user is looking for a one-click or automated solution to execute three separate print jobs with varying color profiles and page ranges.
Ensure your printer is properly connected and that you are using a PDF editor with advanced scripting capabilities (such as Acrobat) to execute custom JavaScript print parameters.
Use JavaScript to Automate the Print Workflow
You can use custom JavaScript code with getPrintParams() to define exact color profiles and page ranges, sending three distinct print jobs automatically.
By utilizing the JavaScript console or creating a folder-level macro, you can script multiple print commands to run sequentially without reopening the print dialog.
Open the JavaScript console in your PDF editor. Input `this.print();` to send the standard, full-color copy of the entire document to your default printer.
Create a new print parameter variable by typing `var pp1 = this.getPrintParams();`. Set it to grayscale by adding `pp1.colorProfile = "Gray Gamma 1.8";`, then execute the print job with `this.print(pp1);`.
Create a second parameter with `var pp2 = this.getPrintParams();` and set the grayscale profile as before. Define the page range using `pp2.firstPage = this.numPages-1;` and `pp2.lastPage = this.numPages-1;`, then run `this.print(pp2);`.
To make this a one-click process in the future, save the combined script as a folder-level script in your application's installation directory and attach it to a custom menu item.

Easily Manage Complex PDF Print Jobs with WPS Office
If you prefer not to configure custom JavaScript macros, WPS PDF offers a highly intuitive print interface that lets you quickly execute customized print jobs—such as color, grayscale, or specific page ranges—with zero coding required.
- 1. Open the PDF Document: Launch WPS Office and open the PDF file you wish to print.
- 2. Print the Full Color Copy: Press Ctrl+P to open the Print dialog, ensure no grayscale options are checked, and click Print to produce your full-color copy.
- 3. Print the Grayscale Copy: Press Ctrl+P again, check the 'Print in Grayscale' or 'Black and White' option in the print properties, and click Print for the full document.
- 4. Print the Last Page in Grayscale: Press Ctrl+P, keep the grayscale setting enabled, select 'Pages' under the Print Range section, enter your final page number, and click Print.

Frequently Asked Questions
Can I set grayscale printing as the default for all my PDFs?
Yes, you can change the default color settings globally in your computer's OS printer properties (Devices and Printers). Once set to black and white, all applications, including your PDF reader, will default to grayscale.
Why does the JavaScript use numPages-1 to print the last page?
In PDF JavaScript APIs, page arrays are zero-indexed. This means the first page is internally recognized as 0. Consequently, the final page is always the total number of pages minus one.
Do I need a premium PDF editor to run print automation scripts?
Generally, yes. Executing advanced JavaScript macros, especially folder-level scripts that bypass the system print dialog, typically requires professional-grade software like Adobe Acrobat Pro rather than basic free readers.




