How to Round Down a Custom Calculation Script in Adobe Acrobat
Question details
The user needs to round down the mathematical result of a custom calculation script within an Adobe Acrobat PDF form field.
- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or editing dynamic PDF forms that require mathematical operations (like division) to automatically round down to the nearest whole integer.
- Observed behavior
- The user wants a destination field to automatically display the rounded-down quotient of a source field divided by a specific number, such as FullTimeEmployees divided by 12.
Ensure you have access to Adobe Acrobat Pro or a similar advanced PDF editor, as the free Adobe Acrobat Reader does not allow you to create or assign custom JavaScript calculation scripts to form fields.
Use JavaScript's Math.floor Method for Custom Calculations
Implement the built-in JavaScript Math.floor function within your PDF form field's calculation properties to always round the final result down to the nearest whole number.
In Adobe Acrobat, custom calculations rely on standard JavaScript. The Math.floor() function takes any decimal number and rounds it down to the next lowest integer, which is perfect for ensuring partial numbers (like employee counts) aren't rounded up incorrectly.
In Adobe Acrobat, enter the 'Prepare Form' mode. Right-click the destination form field where you want the rounded-down calculation to appear and select 'Properties' from the context menu.
In the Field Properties dialog box, navigate to the 'Calculate' tab and select the 'Custom calculation script' option at the bottom.
Click the 'Edit' button and enter the following JavaScript code: event.value = Math.floor(Number(this.getField('FullTimeEmployeesColumnAADDAC').value) / 12); Replace the field name inside the quotes and the divisor as needed for your specific form.
Before saving, double-check that the source field (e.g., 'FullTimeEmployeesColumnAADDAC') is properly formatted as a Number in its own Properties > Format tab, ensuring the calculation script receives a valid numeric value.

Manage and Fill PDF Forms Efficiently with WPS Office
While setting up complex JavaScript calculations requires a specialized PDF builder, you can easily view, fill out dynamic forms, and manage all your PDF documents using the powerful tools built directly into WPS Office.
- 1. Open WPS Office: Launch the WPS Office desktop application and select the 'PDF' tab from the main dashboard to access the PDF toolset.
- 2. Import Your PDF Form: Drag and drop your interactive PDF form into the workspace, or click 'Open' to browse your local files.
- 3. Fill and Manage Data: Use the standard viewing tools to type directly into the form fields. The JavaScript calculations embedded in the PDF will run automatically as you input data.
- 4. Save and Export: Once your form is filled and the calculated data is correct, click 'Save' or use the export options to share your completed PDF document.

Frequently Asked Questions
Can I use Math.round instead of Math.floor in Acrobat?
Yes. If you want to round to the nearest whole number rather than strictly rounding down, you can replace Math.floor() with Math.round() in your custom calculation script.
Why isn't my Acrobat custom calculation script working?
Ensure that the source field names in your script match the actual form field names exactly, as JavaScript is case-sensitive. Also, verify that the fields involved are formatted to accept numeric values and not plain text.
How do I round to a specific number of decimal places instead of a whole number?
To round to two decimal places in Acrobat JavaScript, you can multiply the field value by 100, apply Math.round(), and then divide by 100. For example: event.value = Math.round(myValue * 100) / 100;
Do custom calculation scripts work in free PDF viewers?
Yes. While you generally need a premium tool like Acrobat Pro to write and assign the custom calculation scripts, the resulting dynamic fields will automatically calculate correctly when end-users fill out the form in most standard PDF viewers, including free options like WPS PDF.




