PDF Editing Issues

How to Format PDF Numbers with Spaces and Decimal Commas

Muhammad TalhaMuhammad Talha Nov 2, 2026 869 views

Question details

The user needs to apply a custom number format in PDF form fields to display spaces as thousands separators and a comma as a decimal point, similar to the French number format.

How to Format PDF Numbers with Spaces and Decimal Commas
Product
PDF
Device & OS
not provided
Scenario
Creating or editing interactive PDF forms where specific regional number formatting is required for data entry fields.
Observed behavior
Built-in PDF number fields do not offer an exact equivalent to the Excel '# ##0,00' pattern natively, requiring a custom JavaScript formatting solution.
Before you start

Ensure you have access to a PDF editor that supports JavaScript execution and form field property editing, such as WPS Office Premium or Adobe Acrobat.

Solution 1Recommended

Apply Custom JavaScript for Number Formatting

Use a custom JavaScript format script in the text field properties to automatically format inputted numbers with spaces and decimal commas.

Standard PDF form properties do not include a native preset for spaces as thousands separators. By implementing a short JavaScript snippet, you can force the field to adapt to this specific regional format.

1
Open Field Properties

Right-click the target text field in your PDF form editor and select 'Properties' from the context menu.

2
Navigate to the Format Tab

Click on the 'Format' tab at the top of the Properties window and choose 'Custom' from the Select format category dropdown menu.

3
Enter the Custom Script

In the Custom Format Script box, enter the following code: event.value = util.printf("%,2.2f", event.value).toString().replace(/\./gim, " ");

4
Save and Test

Click 'Close' to save the properties. Test the field by typing a standard number to ensure it formats correctly (e.g., typing 1456123.45 should become 1 456 123,45).

Apply Custom JavaScript for Number Formatting
Calculation Note: If you are using these formatted fields in calculations, remember to convert the comma decimal separator back to a period in your calculation script before performing the math.
Advanced PDF Form Editing

Edit and Manage PDF Forms Seamlessly with WPS Office

WPS Office provides robust PDF editing capabilities, including the creation and management of interactive form fields. You can easily modify text fields, apply formats, and integrate scripts to make your PDF forms professional and localized.

  1. 1. Open WPS PDF: Launch WPS Office and open your PDF document using the built-in PDF reader.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all interactive form editing tools.
  3. 3. Edit Field Properties: Double-click any text field to open its properties menu, where you can adjust custom formatting, logic, and appearance.
Easily create, edit, and fill interactive PDF forms.Supports advanced text field properties and JavaScript formatting.Fully compatible with standard PDF form features used in Adobe Acrobat.Lightweight software with an intuitive, user-friendly interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't standard PDF software have a built-in French number format?

While PDF software includes common formatting options (like standard US or European styles), regional formats like space-separated thousands and comma decimals often require custom JavaScript due to the vast number of global formatting variations.

Can I use this custom script for other currency formats?

Yes. By modifying the util.printf string and the .replace() logic in the JavaScript code, you can customize the formatting to match almost any currency or regional number requirement.

Will these formatted numbers work in PDF calculations?

Standard PDF calculation scripts expect a period as a decimal point. If you format the display with a comma, you must write a custom calculation script that temporarily converts the comma back to a period before performing the math.

Does this custom script work on mobile PDF readers?

JavaScript support varies heavily among mobile PDF readers. While it works perfectly on desktop software like WPS Office or Adobe Acrobat, many basic mobile viewers might not execute custom formatting scripts.