Sir,
Try this:
/**
* Returns the PDCheckbox you want to update or check from the
pdFieldList.
* Note: One of our teams created a PDF form using 'Adobe FormsCentral
developer'.
* after interrogating the forms fields, some inconsistencies arose
with checkboxes/radiobuttons.
*
* Here is a name of a radio button found in the form:
* "VIP_KUf6k4VfAA83KYq7*XLsiA.null"
*
* When it is interrogated, it will appear twice in the interrogation
list as:
* "VIP_KUf6k4VfAA83KYq7*XLsiA.null = 0"
* "VIP_KUf6k4VfAA83KYq7*XLsiA.null = 1"
*
* To determine the state of the radiobutton you would use the form:
*
*
pDFFileManager.getPDCheckbox("VIP_KUf6k4VfAA83KYq7*XLsiA.null","0").isChecked()
*
* @param fullyQualifiedName
* @return - PDCheckbox or null if not found
*/
public PDCheckbox getPDCheckbox(String fullyQualifiedName, String
onValue)
{
PDCheckbox checkbox = null;
for(int i = 0; i < pdFieldList.size();i++)
{
PDField field = pdFieldList.get(i);
if(field instanceof PDCheckbox)
{
try
{
if(field.getFullyQualifiedName().equalsIgnoreCase(fullyQualifiedName) &&
((PDCheckbox)field).getOnValue().equalsIgnoreCase(onValue))
{
checkbox = (PDCheckbox)field;
break;
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
return checkbox;
}
V/R,
Mark Strein
TRAC-FLVN
Wargaming and Simulations Directorate
Analytic Tools Division - Paving Crew
Keeper of the Codes
913-684-9309
-----Original Message-----
From: Wojack, Robert (USTP) [mailto:[email protected]]
Sent: Wednesday, March 23, 2016 10:52 AM
To: [email protected]
Subject: [Non-DoD Source] How to bind distinct OnValues for checkbox group?
We have a client that provides us with interactive PDF forms for our app to
populate fields with user data. The problem is the client sometimes provides us
forms with typos and mistakes and is not responsive about fixing them.
In this case, we are given an interactive PDF form that has a pair of Yes/No
checkboxes. Unfortunately, when creating the PDF, the client bound both
checkboxes to the same "On" value. As a result, when a user checks a box, both
of them get checked (additionally, when a user unchecks a box, they both become
unchecked).
I can use PDFBox to open the file, find the PDCheckbox object in question and
list their On and Off values, but I can't figure out how to update the bindings
to distinct values. Is it possible to do this in PDFBox? If so, can someone
please provide some guidance?
We are using PDFBox 1.8.8. We are not positioned to upgrade to 2.0.0.
Thanks
Bob Wojack
CSRA International, Inc.
Onsite Contractor for the Department of Justice Senior Tech Lead US Trustee
Program
Onsite Email Address:
[email protected]<mailto:[email protected]>
Onsite Phone Number: TBD
Cell#: (301)910-9975
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]