How to Format PDF Numbers with Spaces and Decimal Commas
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.

- Product
- 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.
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.
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.
Right-click the target text field in your PDF form editor and select 'Properties' from the context menu.
Click on the 'Format' tab at the top of the Properties window and choose 'Custom' from the Select format category dropdown menu.
In the Custom Format Script box, enter the following code: event.value = util.printf("%,2.2f", event.value).toString().replace(/\./gim, " ");
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).

Modify Script to Hide Standalone Zeros
Enhance your custom script to prevent a zero from displaying when the field is empty or strictly evaluated as zero.
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. Open WPS PDF: Launch WPS Office and open your PDF document using the built-in PDF reader.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all interactive form editing tools.
- 3. Edit Field Properties: Double-click any text field to open its properties menu, where you can adjust custom formatting, logic, and appearance.

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.




