How to Print Only PDF Rows with Selected Checkboxes
Question details
The user needs to print only the specific planned-item rows in a PDF form where the corresponding checkboxes have been selected, triggered by a custom print button.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Attempting to dynamically filter and print a subset of form data based on user checkbox selections across potentially multiple pages.
- Observed behavior
- By default, PDF software prints the entire document as it appears. Printing only conditional, dynamically selected rows requires custom scripting rather than standard print commands.
Ensure your PDF form fields and checkboxes follow a logical, sequential naming convention. Because standard design software like InDesign cannot natively handle conditional printing, you will need access to professional PDF developer tools capable of writing and executing JavaScript.
Use JavaScript and Template Pages in Adobe Acrobat
The most effective way to print conditional rows is to use Acrobat form scripting to dynamically generate a new, temporary print-ready page containing only the selected data.
Native page layout programs, such as Adobe InDesign, cannot inherently filter and print only checked rows from an exported PDF. This logic must be built directly into the PDF using advanced scripting.
By utilizing hidden template pages and custom JavaScript attached to a Print button, the PDF can evaluate which checkboxes are marked, extract the relevant data, and spawn a clean page explicitly for printing.
Open your interactive PDF in Adobe Acrobat Pro and enter 'Prepare Form' mode. Verify that all row fields and their corresponding checkboxes have distinct, sequential names (e.g., 'Row1_Check', 'Row1_ItemName') to make scripting easier.
Design a blank page within your PDF that serves as the layout for your printed output. Use the Page Templates feature in Acrobat to name this page and set it to hidden.
Insert a Button field into your main form. Open the button's Properties, navigate to the Actions tab, select 'Mouse Up' as the trigger, and choose 'Run a JavaScript' as the action.
Enter a script that loops through the checkbox fields. If a checkbox returns 'true', the script should use the 'spawn' method on your template page, populate the newly spawned fields with the checked row's data, and finally call the 'print()' function.

Manage and Print PDF Forms Seamlessly with WPS Office
While creating dynamic, script-heavy templates requires dedicated developer tools, executing those scripts and managing standard interactive PDFs is effortless with WPS Office. WPS PDF provides a lightweight, highly compatible environment to fill forms, trigger custom print buttons, and manage your documents.
- 1. Open the Form in WPS PDF: Launch WPS Office and open your interactive PDF document containing the checkboxes.
- 2. Fill the Data: Click on the form fields to enter your data and check the boxes for the rows you wish to select.
- 3. Trigger the Print Script: If the PDF includes a pre-programmed JavaScript print button, simply click it. WPS PDF will process the embedded command and open the print dialog.
- 4. Use Standard Print Controls: Alternatively, press Ctrl+P to access the WPS Print menu, where you can easily customize settings such as printing specific pages or printing 'Form fields only'.

Frequently Asked Questions
Can I achieve conditional PDF printing using InDesign alone?
No. Adobe InDesign is a layout tool and cannot embed the necessary conditional logic to print only specific rows. You must export your design to a PDF and add custom JavaScript using PDF editing software.
Why does my custom Print button not work when clicked?
The script may fail if JavaScript is disabled in your PDF reader's security preferences. Additionally, check that the script is correctly assigned to the button's 'Mouse Up' action and that there are no syntax errors in the code.
Is it possible to print only the form fields without the background design?
Yes. Most standard PDF readers, including WPS PDF, allow you to change the 'Comments & Forms' setting in the Print dialog box to 'Form fields only'. This prints just the data you entered without the document's underlying layout.
Do all mobile PDF viewers support JavaScript print buttons?
No. Many mobile PDF viewers have limited or no support for complex JavaScript APIs like template spawning. Advanced dynamic forms are best utilized and printed from desktop PDF software.




