Hello,

I am using the convenience class, TextField, to create PdfFormField.
First I create the text field, then I set the text and the font, color, etc.
But When I open the PDF file using Adobe reader, the font 
of the text is NOT what I set in my java code.  The weired thing is, 
if I click the text field and do some change to it, say, add a 
character, and leave the text field by
clicking anywhere in the PDF, then the font is set to what I set in
the java code. 

Can somebody tell me how to make the PDF show and print the text
in the Text Field exactly as what I set in the java code ? 
I  exhausted all tricks I know but no good luck.


the following is the code snippet. I also attached the PDF file. 
Thank you very much for your help.
Kevin.

---------------------- code snippet -------------------
TextField textfield = new TextField(writer, new Rectangle(100,400,150,425),
"testField");
                        
textfield.setText("test Annotation");
textfield.setTextColor(Color.BLUE);

BaseFont bf = BaseFont.createFont(
BaseFont.HELVETICA_BOLDOBLIQUE,
BaseFont.WINANSI, BaseFont.EMBEDDED);

textfield.setFont(bf);
textfield.setFontSize(12f);
textfield.setBackgroundColor(Color.lightGray);

textfield.setBackgroundColor(new Color(173, 216, 230));
textfield.setAlignment(Element.ALIGN_CENTER);

textfield.setOptions(TextField.EDIT);                                           
        

Chunk ck = new Chunk("                         ");

ck.setFont(new Font(bf, 15f, Font.BOLDITALIC, Color.white));

ck.setAnnotation(textfield.getTextField());

document.add(ck);

----------------------------------------------------------------------

http://www.nabble.com/file/p16851001/textfields.pdf textfields.pdf 
-- 
View this message in context: 
http://www.nabble.com/need-help-on-TextField-font-tp16851001p16851001.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to