PDF Editing Issues

Convert Currency Amounts to Words in an Adobe Acrobat PDF Form

Amos GikundaAmos Gikunda Nov 19, 2026 870 views

Question details

The user needs a PDF form calculation that converts a currency amount into words for a check-writing template.

Convert Currency Amounts to Words in an Adobe Acrobat PDF Form
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A check-writing form should turn an amount such as 10.53 into “Ten Dollars and 53/100.”
Observed behavior
The calculated text field should display the whole-dollar amount in words and the cents as a two-digit fraction.
Before you start

Open the form in an Acrobat edition that supports editing form fields and JavaScript. Create a text field named Amount for the numeric input and another named AmountInWords for the calculated result.

Solution 1Recommended

Add a Custom Calculation Script to the Acrobat Form

Use a calculated text field to convert numeric dollar amounts into words and format cents as a fraction.

The script accepts plain numeric input with an optional minus sign and decimal point. It rounds a third decimal digit half up, supports amounts up to 999,999,999.99 after rounding, and leaves the result blank for invalid or out-of-range input.

1
Open the calculated field

In Acrobat, open the PDF, choose Prepare a form, and open Properties for the AmountInWords text field.

2
Enter the calculation script

On the Calculate tab, select Custom calculation script, click Edit, and paste the following script: var raw = String(this.getField("Amount").valueAsString).replace(/^\s+|\s+$/g, ""); var match = /^(-?)(\d+)(?:\.(\d+))?$/.exec(raw); var result = ""; if (match) { var digits = match[2].replace(/^0+/, "") || "0"; var fraction = match[3] || ""; if (digits.length <= 9) { var dollars = Number(digits); var cents = Number((fraction + "00").substring(0, 2)); if (fraction.length > 2 && Number(fraction.charAt(2)) >= 5) cents++; if (cents === 100) { dollars++; cents = 0; } if (dollars <= 999999999) { var ones = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"]; var tens = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; function underThousand(n) { var words = []; if (n >= 100) { words.push(ones[Math.floor(n / 100)] + " Hundred"); n = n % 100; } if (n >= 20) { words.push(tens[Math.floor(n / 10)] + (n % 10 ? "-" + ones[n % 10] : "")); } else if (n > 0) { words.push(ones[n]); } return words.join(" "); } var parts = []; var millions = Math.floor(dollars / 1000000); var thousands = Math.floor((dollars % 1000000) / 1000); var remainder = dollars % 1000; if (millions) parts.push(underThousand(millions) + " Million"); if (thousands) parts.push(underThousand(thousands) + " Thousand"); if (remainder) parts.push(underThousand(remainder)); var dollarWords = parts.length ? parts.join(" ") : "Zero"; var sign = match[1] && (dollars || cents) ? "Minus " : ""; result = sign + dollarWords + (dollars === 1 ? " Dollar" : " Dollars") + " and " + (cents < 10 ? "0" : "") + cents + "/100"; } } } event.value = result;

3
Save and test the form

Save the PDF, enter 10.53 in Amount, and confirm that AmountInWords displays “Ten Dollars and 53/100.” Also test 0, 1, 1.005, negative values, invalid input, and values near the supported maximum.

4
Check calculation settings

If the result does not update, check that the input field is named Amount, that Acrobat JavaScript is enabled in Preferences, and that the form's calculation order places any calculations feeding Amount before AmountInWords.

Add a Custom Calculation Script to the Acrobat Form
Verify financial output: PDF viewers vary in their support for Acrobat JavaScript. Test the completed form in the viewer recipients will use, and verify amounts before issuing financial documents.
Free Microsoft Office alternative

Work with Check Templates and Documents in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with documents and spreadsheets. Its Microsoft Office format compatibility makes it easy to move existing files into WPS. The Acrobat JavaScript calculation still needs to be created and tested in Acrobat and a compatible PDF viewer.

Work with check-related templates and supporting documents in one office suiteOpen and edit Microsoft Word and Excel formats, including DOCX and XLSXUse a familiar interface when moving from Microsoft OfficeGet a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Where do I add JavaScript to an Acrobat form field?

In Prepare a form, open the output field's Properties, select the Calculate tab, choose Custom calculation script, and click Edit.

Can the script accept a dollar sign or commas?

No. Enter plain numbers such as 1050.25 or -10.53 in the Amount field. The supplied script leaves the output blank if the input contains a dollar sign or commas.

How does the script handle more than two decimal places?

It uses the third decimal digit to round the cents half up. For example, 1.005 becomes “One Dollar and 01/100.”

Why is the calculated field blank?

Check that the input field is named Amount and contains a valid number within the supported range. Also check Acrobat's JavaScript preferences and test the form in a viewer that supports Acrobat form scripts.