Solved

Calcululation in PDF Form

Posted on 2014-10-23
7
195 Views
Last Modified: 2014-10-24
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
Comment
Question by:ITworks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 16

Expert Comment

by:krakatoa
ID: 40399803
There is something called PDFBox, open source library.
0
 
LVL 16

Expert Comment

by:krakatoa
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 bad = 1;

float percentgood = 100/(universe/good);
float percentbad = 100/(universe/bad);

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

Open in new window


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

Author Comment

by:ITworks
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Author Comment

by:ITworks
ID: 40400457
1.png
0
 
LVL 4

Author Comment

by:ITworks
ID: 40400461
2.png
0
 
LVL 16

Expert Comment

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

Accepted Solution

by:
captain earned 500 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

Open in new window

.

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java imports not found 4 67
American Express @Work site and Java 4 90
Where to place postgres JDBC driver jar on tomcat 8 64
Java array 21 139
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question