PDF Editing Issues

Fix Acrobat JavaScript Rounding to Two Decimal Places

Steven ParkerSteven Parker Nov 19, 2026 868 views

Question details

Display calculated Acrobat form values to two decimal places and handle rounding consistently in financial calculations.

Fix Acrobat JavaScript Rounding to Two Decimal Places
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A calculated PDF form field applies a percentage to a monetary value.
Observed behavior
A calculation can produce a value such as 82.215 when the desired display is 82.22.
Before you start

Open the PDF in Adobe Acrobat and identify the source field and the calculated destination field. Confirm the rounding rule required for your form, especially for values that fall halfway between cents.

Solution 1Recommended

Format the Acrobat calculation to two decimal places

Use Acrobat JavaScript formatting when the main goal is to control how the calculated result is displayed.

1
Open the form editor

In Acrobat, open the PDF and choose All tools > Prepare a form. Select the calculated destination field and open its Properties.

2
Add the calculation

On the Calculate tab, select Custom calculation script and click Edit. Enter: event.value = util.printf("%.2f", Number(this.getField("Amount").value) * 0.90); Replace Amount with the actual source field name.

3
Set the field format

On the Format tab, choose Number and set Decimal Places to 2. Close the field properties, then enter a test value in the source field and check the result.

Format the Acrobat calculation to two decimal places
Formatting is not a complete financial rounding policy: util.printf formats the result, but binary floating-point representation can affect halfway cases. It also does not correct earlier calculations that used fractional cents.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface for working with PDFs and common Office files. It supports a smooth move between document formats, though it does not fix Acrobat-specific JavaScript calculations.

Open and work with PDF documents in a familiar interfaceCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXUse a free, lightweight suite for everyday document tasks
microsoft office alternative - wps office

Frequently Asked Questions

Where do I set two decimal places in an Acrobat form field?

Choose All tools > Prepare a form, open the destination field's Properties, and select Number with 2 decimal places on the Format tab.

Does util.printf fix every financial rounding error?

No. util.printf("%.2f", value) formats the result, but floating-point representation can affect halfway cases, and formatting does not fix fractional cents accumulated in earlier calculations.

Why use whole cents in a calculation?

Whole-cent arithmetic makes it easier to apply a consistent rounding rule at each calculation stage. For example, calculate a 90% result from integer cents, round that result to a cent, and divide by 100 for display.

What should I change if my source field is not named Amount?

In the custom calculation script, replace Amount in this.getField("Amount") with the exact name of your source form field.