PDF Editing Issues

How to Automatically Format Numbers in an Acrobat PDF Text Field

John WilsonJohn Wilson Oct 28, 2026 869 views

Question details

The user needs to automatically format a raw 14-digit input number into a specific punctuated pattern (e.g., 22.222.355/0001-09) within a PDF form text field.

How to Automatically Format Numbers in an Acrobat PDF Text Field
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating or editing an interactive PDF form where specific numeric inputs, such as business registration numbers or tax IDs, require strict structural formatting.
Observed behavior
The text field accepts raw numbers but does not automatically apply the required punctuation and spacing without custom formatting rules.
Before you start

Ensure you have Adobe Acrobat Pro installed, as standard free PDF readers do not support editing form fields or adding custom JavaScript formatting scripts.

Solution 1Recommended

Apply Custom Formatting Using Acrobat JavaScript

Use the built-in Acrobat JavaScript function util.printx() to force a 14-digit number into your desired format automatically after the user enters it.

This method requires writing a brief custom formatting script in the field's properties. The util.printx() function applies a specific pattern to the input string, provided the input always contains the exact same number of digits (in this case, 14 digits).

1
Enter Prepare Form Mode

Open your PDF in Adobe Acrobat, navigate to the 'Tools' menu, and select 'Prepare Form'.

2
Open Field Properties

Right-click the target text field where users will enter the number and select 'Properties' from the context menu.

3
Navigate to the Format Tab

In the Properties dialog box, click on the 'Format' tab. From the 'Select format category' dropdown, choose 'Custom'.

4
Add the Custom Script

In the 'Custom Format Script' box, enter the following code: if (event.value) { event.value = util.printx("99.999.999/9999-99", event.value); }

5
Close and Test

Click 'Close' to save the properties. Click 'Preview' at the top right to test the field by typing a 14-digit number like 22223555000109.

Apply Custom Formatting Using Acrobat JavaScript
Digit Consistency: The number '9' in the util.printx function represents a placeholder for any digit. Ensure your users input exactly 14 digits, otherwise the formatting may misalign.

Easily Manage and Edit PDF Forms with WPS Office

While complex JavaScript formatting requires specialized software, WPS Office provides a highly intuitive PDF editor to easily create, fill, and manage interactive PDF forms for your daily document workflows.

  1. 1. Open PDF in WPS Office: Launch WPS Office and open your PDF file using the PDF tab.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view available form creation and editing tools.
  3. 3. Add or Edit Fields: Select 'Text Field' to add new input areas, or click on existing fields to modify their properties directly.
  4. 4. Save and Export: Once your form is complete, save the document to ensure all interactive fields are preserved.
Easily insert text fields, checkboxes, and dropdowns into any PDF document.Fully compatible with standard PDF forms and documents created in Adobe Acrobat.Lightweight alternative with an easy-to-use interface for both beginners and professionals.
microsoft office alternative - wps office

Frequently Asked Questions

Do I have to use programming to format numbers in a PDF text field?

For complex, non-standard formats like '22.222.355/0001-09', custom JavaScript is currently the only robust method in Acrobat. Built-in formatting options only cover standard dates, times, percentages, and basic zip codes.

What happens if a user enters fewer than 14 digits?

If the input is shorter than the placeholders in the util.printx() function, the formatting may misalign or fail to apply correctly. It is recommended to add a custom validation script to ensure exactly 14 digits are entered before the format is applied.

Can I use this JavaScript format in free PDF readers?

Yes. While you need a Pro PDF editor to add the JavaScript formatting rule to the form field initially, standard free PDF readers will successfully execute the script and format the number when a user subsequently fills out the form.