How to Select All Checkboxes in a PDF Using Adobe Acrobat JavaScript
Question details
The user needs a method to batch-select all interactive checkboxes across a PDF document or within specific pages.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Working with complex interactive PDF forms that contain multiple checkboxes requiring simultaneous selection.
- Observed behavior
- The user aims to automate the process of checking all boxes using a JavaScript loop instead of clicking them manually one by one.
Ensure your PDF contains standard interactive form fields and that you have access to the JavaScript Debugger Console in Adobe Acrobat (typically found in the Tools menu).
Execute a JavaScript Loop in the Acrobat Console
Use a simple JavaScript loop in the Acrobat JavaScript Debugger console to instantly find and check all checkboxes in the entire document.
This method iterates through every form field in your PDF. When it identifies a field with the type "checkbox", it automatically sets its state to checked.
In Adobe Acrobat, press Ctrl+J (Windows) or Cmd+J (Mac) on your keyboard to open the JavaScript Debugger console.
Copy and paste the following code into the console window: for (var i=0; i<this.numFields; i++) { var f = this.getField(this.getNthFieldName(i)); if (f && f.type=="checkbox") f.checkThisBox(0, true); }
Highlight the pasted code with your mouse, and press Ctrl+Enter (Windows) or Cmd+Return (Mac) on your keyboard to run the script. All checkboxes in the PDF will instantly be checked.

Select Checkboxes on Specific Pages Only
Modify the JavaScript code to restrict the batch-selection of checkboxes to a specific page range rather than the entire document.
Fill and Manage PDF Forms Easily with WPS Office
While executing JavaScript codes can be helpful for automation, WPS Office provides an intuitive, user-friendly interface that makes managing, filling, and editing interactive PDF forms effortless for users of all skill levels.
- 1. Open your PDF form in WPS Office: Launch WPS Office and open your interactive PDF document using the built-in WPS PDF tool.
- 2. Access the Form tools: Navigate to the 'Form' tab on the top ribbon to view and interact with all form fields, including checkboxes and text fields.
- 3. Fill or edit checkboxes: Click directly on the checkboxes to select them, or use the straightforward form editing tools to manage multiple form fields at once without needing to write custom scripts.

Frequently Asked Questions
How do I uncheck all checkboxes in a PDF using JavaScript?
You can modify the script to uncheck the boxes by changing the 'true' parameter to 'false'. The modified execution line would look like this: if (f && f.type=="checkbox") f.checkThisBox(0, false);
Can I attach this JavaScript to a button in my PDF?
Yes, you can create an interactive form button in Adobe Acrobat, open its Properties, go to the Actions tab, select 'Run a JavaScript', and paste the loop code there. Anyone manipulating the PDF can then click the button to execute the script.
Why is the JavaScript loop not selecting my checkboxes?
This usually happens if the form fields are flattened, non-interactive, or if the field types are not strictly defined as a "checkbox" in the form properties. Ensure you are in 'Prepare Form' mode to verify that the checkboxes are actual interactive fields.




