Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# Calcululation in PDF Form

Posted on 2014-10-23
Medium Priority
224 Views
I have a form that I'd like to calculate the results in and I'm hoping someone could help me.

I want to calculate the percentage of 2 fields.

In the top right hand side of this form is Score: _____ Good   ____  Bad     _____  %
-form.pdf
0
Question by:ITworks
• 3
• 3

LVL 17

Expert Comment

ID: 40399803
There is something called PDFBox, open source library.
0

LVL 17

Expert Comment

ID: 40400015
Reading your question again, maybe you don't need the library interface, in which case the calc would be on the lines of

``````float universe=5;
float good =4;

float percentgood = 100/(universe/good);

System.out.println(percentgood);
``````

(but excuse me if you were not looking for code, (as it is quite straightforward)).
0

LVL 4

Author Comment

ID: 40400451
Would I enter this info under Text Field Properties, Calculate, Custom calculation script:?

And....my fields are really named:
Good, Bad and Calc with Calc being the field where I want the formula calculated.
0

LVL 4

Author Comment

ID: 40400457
0

LVL 4

Author Comment

ID: 40400461
0

LVL 17

Expert Comment

ID: 40400467
I am not familiar with the PDFBox library, and so I cannot speak about how it interfaces with Java.
0

LVL 31

Accepted Solution

captain earned 2000 total points
ID: 40401960
Hi

you don't need JS

go  to your PDF. Format Good and Bad as numbers, Calc as Percentage (Right click Properties on each field)

The in Calc field go to Calculation and use the Simplified field notation and put
``````Good/Bad/100
``````
.

This will give you percentage of the two fields. You need the "/100" as stupidly Adobe PDF makes its own x100 calculation for the Percentage value

I have a sample attached.

hth
capt.
Percentage.pdf
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
###### Suggested Courses
Course of the Month11 days, 20 hours left to enroll