Set a Minimum Value for a PDF Form Calculation in Adobe Acrobat
Question details
Calculate the O2Min PDF form field as Weight multiplied by 50, with a minimum result of 0.5.

- Product
- PDF form with Acrobat-compatible JavaScript
- Device & OS
- not provided
- Scenario
- A PDF form needs to calculate O2Min from the value entered in the Weight field.
- Observed behavior
- O2Min should display Weight multiplied by 50, or 0.5 when the calculated result is lower.
Open the PDF in an editor that supports custom form calculation scripts, such as Adobe Acrobat Pro. Check that the form fields are named exactly Weight and O2Min, and that Weight accepts numeric values.
Add a Custom Calculation Script to O2Min in Adobe Acrobat
Use this script to calculate Weight × 50 while enforcing a minimum result of 0.5.
Open the PDF in Adobe Acrobat Pro and select All tools > Prepare a form.
Double-click the O2Min field to open its Properties dialog, then select the Calculate tab.
Select Custom calculation script, click Edit, and enter: var result = this.getField("Weight").value * 50; if (result < 0.5) result = 0.5; event.value = result;
Confirm the script, close the Properties dialog, and save the PDF. Enter values in Weight to verify that O2Min shows 0.5 for results below 0.5 and Weight × 50 otherwise.

Work With PDFs and Office Files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility helps you move existing files into your workflow; use Acrobat for the custom PDF JavaScript calculation described above.

Frequently Asked Questions
What happens when Weight is less than 0.01?
Weight multiplied by 50 is below 0.5, so the script sets O2Min to 0.5. At Weight = 0.01, the calculated result is exactly 0.5.
Where do I enter the PDF calculation script?
In Adobe Acrobat Pro, open All tools > Prepare a form, double-click O2Min, and choose Calculate > Custom calculation script > Edit.
Why does an empty Weight field show 0.5 in O2Min?
In this calculation, an empty field is treated as zero. Because zero is below the minimum, the script assigns 0.5 to O2Min.
Will the calculation work in every PDF viewer?
Not necessarily. The viewer must support Acrobat-compatible form JavaScript and allow it to run. Test the saved PDF in the viewer recipients will use.




