Hi. 

My task at hand is to change the various field properties like 
foreground color, back color, font name etc for the fields of an 
existing pdf file. 

I understand that there is a method setFieldProperty(...) and 
subsequently calling the regenerateField() method for doing the 
same. This strategy is working fine but only for a pdf file that's 
created using the iText api. 

If i attempt to do the same on an existing pdf created using 
Acrobat Professional edition 6.0, setFieldProperty returns false 
(as if the property name doesn't exist). 
Below is a code snippet for doing the same : 

try { 
PdfReader reader = new PdfReader 
("c://SamplePDF2.pdf"); 
PdfStamper stamp1 = new PdfStamper(reader, new 
FileOutputStream("c://SamplePDF2Filled.pdf")); 
AcroFields form1 = stamp1.getAcroFields(); 
boolean outcome = form1.setFieldProperty 
("pdfName","bgcolor",Color.yellow,null); 
System.out.println(outcome); 
form1.regenerateField("pdfName"); 
form1.setField("pdfName", "Aprajit"); 
form1.setField("pdfAge", "23"); 
stamp1.close(); 
} 
catch (Exception de) { 
de.printStackTrace(); 
} 

The field whose property i want to set is pdfName (which is the 
name 
of field in pdf generated using Acrobat) It is able to set the field 
value, but unable to change the field property on an acrobat 
generated form. 

Please let me know, if somebody could come with a solution. 

Thanks and Regards 
Sunny
-- 
View this message in context: 
http://www.nabble.com/Trouble-in-attempting-to-change-the-field-properties-using-setFieldProperty%28%29-method.-tf2736691.html#a7635037
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to