Hi I am populating data to the given PDF form.
In a 'check box ' I am trying to enable it. But it is not happening..
My code is below.. Anyone could help why its not working?
URLConnection conn = url.openConnection();
InputStream in = conn.getInputStream();
PdfReader reader = new PdfReader( in );
AcroFields acroFields = reader.getAcroFields();
File generatedFile = new File("c:/temp/t2.pdf");
PdfStamper filledOutForm = new PdfStamper(reader , new
FileOutputStream(generatedFile));
acroFields = filledOutForm.getAcroFields();
Set<String> fields = acroFields.getFields().keySet();
for (String key : fields) {
//System.out.print("\t\t"+key + "\t:\t");
switch (acroFields.getFieldType(key)) {
case AcroFields.FIELD_TYPE_CHECKBOX:
System.out.print("Checkbox :");
boolean flag = acroFields.setField(key,
"On");
System.out.println("\t"+key + " : "+flag);
break;
case AcroFields.FIELD_TYPE_TEXT:
System.out.println("Text");
acroFields.setField(key, key);
break;
default:
System.out.println("?");
}
}
filledOutForm.close();
Thanks & Regards
Karthik
PNC Investments
Two PNC Plaza
620 Liberty Avenue, Pittsburgh, PA 15222
412-768-2941 | karthikeyan.muruge...@pnc.com
The contents of this email are the property of PNC. If it was not addressed to
you, you have no legal right to read it. If you think you received it in error,
please notify the sender. Do not forward or copy without permission of the
sender. This message may contain an advertisement of a product or service and
thus may constitute a commercial electronic mail message under US Law. The
postal address for PNC is 249 Fifth Avenue, Pittsburgh, PA 15222. If you do not
wish to receive any additional advertising or promotional messages from PNC at
this e-mail address, click here to unsubscribe.
https://pnc.p.delivery.net/m/u/pnc/uni/p.asp
By unsubscribing to this message, you will be unsubscribed from all advertising
or promotional messages from PNC. Removing your e-mail address from this
mailing list will not affect your subscription to alerts, e-newsletters or
account servicing e-mails.
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php