How to Update PDF Word Count While Typing in Adobe Acrobat
Question details
The user wants to display a live, dynamically updated word or character count as they type inside a PDF form text field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or filling out interactive PDF forms with text fields where character or word limits need to be monitored in real-time by the user.
- Observed behavior
- By default, text fields only evaluate scripts and update counts when the user clicks out of or exits the field, rather than updating dynamically with each keystroke.
Ensure you have access to a professional PDF editor like Adobe Acrobat Pro that supports adding and editing custom JavaScript in form fields.
Implement a JavaScript Keystroke Event
Use a custom JavaScript triggered by the Keystroke event to calculate and display the word count dynamically as the user types.
Standard calculation scripts typically run only when a user clicks outside the text field. To achieve a live counter, you must bind your script to the Keystroke event, which triggers every time a key is pressed.
You will need two fields: one for the user to type their input, and a second read-only text field to display the live word or character count.
Open your PDF in Adobe Acrobat, navigate to the 'Tools' menu, and select 'Prepare Form' to make your document fields editable.
Right-click the text field you want to monitor for word count, select 'Properties', and navigate to the 'Format' tab.
Choose 'Custom' from the Select Format Category dropdown, then click 'Edit' next to the Custom Keystroke Script option. Input your JavaScript code that calculates the combined length of event.value and event.change, and outputs the result to your designated counter field.
Click 'OK' and close the properties window. Exit the form editing mode and begin typing in the text field to verify that the target counter field updates instantly with each keystroke.

Experience Seamless PDF & Document Editing with WPS Office
If you are looking for a simpler way to manage, edit, and fill out PDFs without dealing with complex JavaScript coding, WPS Office is an excellent, lightweight alternative. It offers powerful PDF editing tools alongside a complete suite for your document needs.
- 1. Download and Install: Get WPS Office from the official website and install the lightweight suite on your device.
- 2. Open your PDF: Launch WPS Office and drag your PDF file directly into the workspace to open it instantly.
- 3. Edit and Fill Forms: Navigate to the 'PDF Edit' or 'Form' tabs to add text, fill out form fields, or convert the document with just a few clicks.

Frequently Asked Questions
Why does my PDF word count only update when I click away?
By default, Acrobat evaluates most form scripts (like calculation or format scripts) only when a user exits the field or 'commits' the data. To force real-time updates, you must specifically utilize a Keystroke event script.
Do I need to know JavaScript to add a live word counter to a PDF?
Yes, creating a live character or word counter in a standard PDF form requires using custom JavaScript to capture the Keystroke event and accurately calculate the length of the inputted text.
Can a live word count prevent users from typing past a limit in a PDF?
Yes. A Keystroke script can be programmed to reject keystrokes (by setting event.rc = false) once a specific character or word limit is reached, effectively restricting the text field length in real-time.
Where do I add the Keystroke script in Adobe Acrobat?
You can add it by entering the 'Prepare Form' mode, right-clicking your target text field to open its Properties, and selecting 'Custom' under the Format tab to add a Custom Keystroke Script.




