Hello,
I'm new to iText, I have one question;
I have some pdf files on which I created some Acroforms with Adobe Acrobat
Professional 6. I manage to write on the fields, but I cannot set font type
(I would like Courier) nor size. I know I can set them when I create the
form from Acrobat, but I would like to do it from my java code instead using
form.setFieldProperty as described on p.507 of the inAction book.
Here is my code (between comments are the Exceptions I'm getting):

 PdfStamper stamper = new PdfStamper(reader, new
FileOutputStream("/home/rinaldo/moduloriempito.pdf"));
/*reader opens the existing pdf file*/            
               
            form = stamper.getAcroFields();
           
           
form.setFieldProperty("cognome","textfont",FontFactory.getFont(FontFactory.COURIER),null);
            /*if I try to set textfont i get a java.lang.ClassCastException:
com.lowagie.text.Font
               at com.lowagie.text.pdf.AcroFields.setFieldProperty(Unknown
Source)*/          
           
            form.setField("cognome", "xxxxx");
            /*only setting this value seems to work*/
           
            stamper.close();

What am I doing wrong?
Cheers from Italy
A.D.

ps: this is a repost. I'm sorry for that, I realized I had to subscribe to
the ML too, not only to Nabble, and my first post is being moderated for 2
hours and a half. 
-- 
View this message in context: 
http://www.nabble.com/Setting-font-on-Acroform-tf3883628.html#a11007173
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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