PDF Editing Issues

How to Remove Trailing Zeros from Number Fields in Adobe Acrobat

Tauseeq MagsiTauseeq Magsi Nov 3, 2026 869 views

Question details

The user needs to format PDF number fields dynamically so that unnecessary trailing zeros are hidden while preserving necessary decimals.

How to Remove Trailing Zeros from Number Fields in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Formatting an interactive PDF form where numeric inputs vary in decimal length.
Observed behavior
Acrobat's built-in Number format rigidly enforces a set number of decimal places, forcing whole numbers like '3' to display as '3.00'.
Before you start

Ensure you have Adobe Acrobat Pro or Standard installed, as the free Adobe Reader version does not support creating or editing form field properties.

Solution 1Recommended

Apply a Custom JavaScript Format to the Number Field

By replacing the standard Number format with a custom JavaScript snippet, you can dynamically strip out trailing zeros after the decimal point.

The built-in Number format in Acrobat applies fixed decimal constraints. To achieve dynamic decimals, you must utilize the 'Custom' format category to run a simple script whenever a user inputs a number.

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 on the specific number field you want to modify and choose 'Properties' from the context menu.

3
Navigate to the Format Tab

In the Properties dialog box, click on the 'Format' tab located at the top.

4
Select Custom Format

From the 'Select format category' dropdown menu, choose 'Custom'.

5
Enter the Custom Script

In the 'Custom Format Script' text box, paste the following code: event.value = util.printf("%,02.2f", event.value).replace(/\.?0+$/, "");

6
Save and Test

Click 'Close' to save the properties, exit Prepare Form mode, and type test numbers into the field to verify the behavior.

Apply a Custom JavaScript Format to the Number Field
Expected Result: When applied successfully, an input of 8.25 remains 8.25, 22.70 simplifies to 22.7, and 3.00 is displayed cleanly as 3.

Edit and Manage PDF Forms Easily with WPS Office

WPS Office includes a powerful PDF editor that allows you to easily view, fill, and manage interactive PDF forms without the steep learning curve of complex scripting.

  1. 1. Open your PDF: Launch WPS Office and open your interactive PDF form document.
  2. 2. Fill the Form: Click directly into the form fields to input your data or numbers.
  3. 3. Edit the Document: Navigate to the 'Edit' tab to modify standard PDF text and elements if necessary.
  4. 4. Save Changes: Save the document to keep your form inputs and formatting intact.
Easily fill out and navigate standard interactive PDF forms.Highly compatible with Adobe Acrobat and standard PDF formats.Lightweight alternative offering a comprehensive suite for Word, Excel, PowerPoint, and PDF editing.
QA img-9

Frequently Asked Questions

Why does the default number format add extra zeros?

Acrobat's built-in Number format uses a fixed decimal setting (usually 2 places) for visual uniformity across ledgers and invoices. It automatically pads whole numbers with zeros to meet this fixed length.

Do I need programming skills to fix this issue?

No programming experience is required. You simply need to copy and paste the provided one-line custom JavaScript code into the format script box of the field's properties.

Will this custom format script function correctly on mobile PDF readers?

JavaScript support varies significantly across mobile PDF readers. While the script works reliably in the desktop version of Adobe Acrobat and Adobe Reader, some third-party or basic mobile apps may fail to execute the formatting script.