PDF Printing Issues

How to Print Selected PDF Pages as One File Using Checkboxes

Steven ParkerSteven Parker Nov 5, 2026 868 views

Question details

The user wants to print specific pages of a PDF form as a single combined print job based on interactive checkbox selections.

How to Print Selected PDF Pages as One File Using Checkboxes
Product
PDF
Device & OS
not provided
Scenario
Using interactive checkboxes in a PDF form to dynamically select specific pages for printing without creating separate print queue jobs.
Observed behavior
Calling the print method individually for each selected checkbox results in multiple separate print jobs instead of one consolidated file.
Before you start

Ensure your PDF editor supports JavaScript execution and that you have permission to edit the interactive form fields within the document.

Solution 1Recommended

Use JavaScript PrintParams to Combine Print Jobs

Create an array to collect selected page ranges and pass it to the getPrintParams method to send a single, combined print job.

When you call the print method multiple times, the printer spooler treats each call as a separate document. By collecting the target pages into an array first, you can define a custom print range and execute a single print command.

1
Access the JavaScript Editor

Open the JavaScript editor or the properties panel of the button where the print action is triggered.

2
Initialize the Print Array

Create an empty array to store the pages you want to print by typing: var pagesToPrint = [];

3
Evaluate Checkbox Values

Add conditional statements to check the value of each checkbox and push the corresponding page index to the array. For example: if (this.getField("page 1").value == "Yes") pagesToPrint.push([2,2]);

4
Configure Print Parameters

Check if the array has items, then retrieve the print parameters and assign the array to the printRange property: var pp = this.getPrintParams(); pp.printRange = pagesToPrint;

5
Execute the Print Command

Execute the combined print command using the configured parameters: this.print(pp);

Use JavaScript PrintParams to Combine Print Jobs
Page Indexing: Remember that JavaScript arrays and PDF page indices are typically zero-based, meaning page 1 is usually index 0, page 2 is index 1, etc. Adjust the numbers in the push method accordingly.
Advanced PDF Form Editing

Edit Interactive PDF Forms with WPS Office

WPS PDF provides robust tools for creating, editing, and managing interactive PDF forms. You can easily add checkboxes, buttons, and configure advanced print settings all in one place.

  1. 1. Open your PDF: Launch WPS Office and open your interactive PDF document.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access interactive form controls.
  3. 3. Manage Form Fields: Add, modify, or configure your checkboxes and interactive buttons as needed.
  4. 4. Print Custom Ranges: Use the Print dialog (Ctrl+P) to manually select and manage print ranges if scripting is not required.
Easily insert and manage interactive form fields like checkboxes and buttons.Supports comprehensive print settings including custom page ranges.Fully compatible with standard PDF formats and complex interactive forms.Lightweight and efficient performance for handling large documents.
microsoft office alternative - wps office

Frequently Asked Questions

Why are my PDF pages printing as separate jobs?

If a script triggers the print function individually for each selected page, the printer queue treats each trigger as a standalone job. Combining the page ranges into a single print command array resolves this issue.

Can I manually select discontinuous pages to print without scripting?

Yes. In the WPS PDF print dialog, you can enter specific page numbers separated by commas (e.g., 1, 3, 5) in the 'Pages' field to print them together as one continuous job.

Are PDF JavaScript page numbers zero-based?

Yes, when scripting in PDFs, page 1 is generally referred to as index 0, page 2 as index 1, and so forth. Always check your specific script logic to ensure the correct pages are targeted when using the push method.