How to Extract Formatted Display Values from Acrobat PDF Number Fields
Question details
The user needs to retrieve the exact formatted string displayed in a PDF number field (such as "25,10 USD***") instead of the underlying raw numeric value.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Extracting form data from interactive PDFs where specific number, locale, and currency formatting rules are applied.
- Observed behavior
- Standard extraction methods return the raw numeric value (e.g., 25.1) rather than the visually formatted string displayed to the user.
Ensure you have access to the PDF's script editor and basic knowledge of Acrobat JavaScript, as you will need to write a custom script to recreate the display formatting.
Use Acrobat JavaScript to Reformat the Extracted Value
Because the raw value is separated from the display format in PDF forms, you must use JavaScript formatting functions to reconstruct the displayed string dynamically.
Interactive PDF forms store the raw numeric value to allow for background calculations, applying display formatting visually on top of it. Because you cannot directly extract the formatted display string from a standard Acrobat form field, you must script a function that retrieves the raw value and explicitly applies the same formatting rules.
Open your PDF form in editing mode and access the JavaScript editor or the specific form field's action scripts.
Write a script to retrieve the raw field value using a command like `var rawValue = this.getField("YourFieldName").value;`.
Use the built-in `util.printf()` or `util.printx()` JavaScript functions to format the retrieved number.
Explicitly define the locale, decimal separator, currency code, and any custom suffixes (e.g., "***") within your formatting function to perfectly match the original field's visual display properties.

Edit and Manage PDF Forms with WPS Office
WPS Office provides a robust set of PDF tools, allowing you to easily view, fill, and manage interactive PDF forms, including checking field properties and extracting form data efficiently.
- 1. Open PDF in WPS Office: Launch WPS Office and open your interactive PDF document containing the forms.
- 2. Navigate to Form Tools: Switch to the 'Form' tab on the top ribbon to access the form viewing and editing utilities.
- 3. Inspect Form Fields: Click on the specific number fields to interact with them or view their properties depending on your document's permissions.
- 4. Export Form Data: Use the 'Export' or 'PDF to Excel' features to pull your structured form data into a spreadsheet for easier formatting and extraction.

Frequently Asked Questions
Why does extracting a PDF form field give me a different number than what is displayed?
PDF forms store numbers as raw data (e.g., 25.1) to allow for background calculations. The displayed format (e.g., "25,10 USD***") is a visual overlay. Standard extraction pulls the raw calculation data, not the visual text.
Can I copy the formatted text directly without scripting?
If you are simply reading the PDF, you can manually highlight and copy the text. However, automated extraction tools or form data exports will generally pull the raw underlying value, necessitating a script to recreate the format if automation is required.
Does util.printf() work in all PDF viewers?
The util.printf() function is part of the standard Acrobat JavaScript API. It works reliably in professional PDF editors like Adobe Acrobat and WPS Office, though some basic web browsers or mobile viewers may have limited JavaScript support.




