How to Use a Comma as a Decimal Separator in Acrobat JavaScript PDF Forms
Question details
The user needs to format calculated currency values in a PDF form using a comma as the decimal separator and a period for thousands (e.g., 100,00) instead of standard US formatting.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or editing interactive PDF forms with calculated currency values requiring European number formatting conventions.
- Observed behavior
- Default numerical formatting applies a period as the decimal separator, which does not match the desired regional format requirements.
Ensure you have access to the form editing mode in Adobe Acrobat and that your target text field is set up to accept custom calculation scripts.
Apply the util.printf Format Option 2
Use the built-in JavaScript utility function with option 2 to force the formatting to use a comma for decimals and a period for thousands.
In Acrobat's JavaScript formatting, the util.printf function accepts different formatting style options. Option 2 is specifically designed to output European-style formatting (e.g., 1.234,56), whereas Option 0 outputs standard US formatting (e.g., 1,234.56).
Open your PDF form in Adobe Acrobat, navigate to the Tools menu, and select Prepare Form.
Right-click the text field where the calculated currency value will appear and select Properties.
Go to the Calculate tab, select 'Custom calculation script', and click the Edit button.
Input the following script: event.value = (event.value != 0) ? util.printf('€ %,2.2f', event.value) : ''; and then click OK.

Handle PDF Forms and Documents Effortlessly with WPS Office
While Adobe Acrobat offers advanced JavaScript functionality for highly specific form logic, WPS Office provides a free, lightweight, and highly compatible alternative for handling PDFs, documents, spreadsheets, and presentations. Edit PDF text, manage basic forms, and convert files with an intuitive, familiar user interface.
- 1. Download WPS Office: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Open Your PDF: Launch WPS Office, select 'PDF Edit', and open your PDF document to start viewing or editing.
- 3. Edit and Save: Use the comprehensive PDF toolset to modify your document, then save or export it effortlessly.

Frequently Asked Questions
Why does my PDF form use a period instead of a comma for decimals?
By default, Acrobat utilizes standard US formatting (Option 0) which applies commas for thousands and periods for decimals. You must explicitly change the format style in the field properties using Option 2 via JavaScript to override this.
Can I format other currencies besides the Euro using this script?
Yes, you can replace the Euro symbol in the util.printf string with any other currency symbol you need, as the underlying formatting logic only affects the numbers and separators.
Does formatting the value as a string affect other calculations?
Yes. Once a value is formatted with commas and currency symbols, it technically becomes a text string. If you need to use this specific field's value in subsequent calculations, you will need to parse the number back into a raw numeric format first.
How do I hide the currency symbol when the calculation field is empty?
The provided JavaScript snippet uses a conditional statement. If the calculated value is zero or empty, the script returns an empty string instead of formatting a zero, keeping your form clean.




