While working with iTextSharp to fill AcroFields in a PDF, I noticed the font size of the text fields were a little larger than I wanted.
I found this great post that helped me out http://www.keithnordstrom.com/?tag=/itextsharp
which boils down to this:
AcroFields fields = stamper.AcroFields;
bool set = fields.SetFieldProperty(fieldName, "textsize", 12.0f, null);
The only thing to note is that you must set the form field size before putting text into the field otherwise it won't work...
You are awesome!! After so much searching finally got it to do the simplest thing. Thank you! =D
ReplyDeleteGlad it worked
DeleteThanks!!
ReplyDeleteThis just doesn't seem to work for me no matter what I do. Just returns false. I posted about it on Stack Overflow. http://stackoverflow.com/questions/15960132/itextsharp-setfieldproperty-returns-false
ReplyDeleteMaybe you can help me?
let me look.
ReplyDeletewhen i copied your code snippet and used it, it worked. you may have to send me your files. something else is wrong.
ReplyDeleteleave your email and i will send you a message. i won't publish your email address.
Thank you so much!!
ReplyDeleteSure. Glad it worked for you!
DeleteI was setting the field properties after setting the text. Makes sense to do it before, but it was not occurring to me and I was getting super frustrated. You probably saved me from having to buy a new monitor. Thank you!
ReplyDeleteI am so glad this helped you!
DeleteThanks, that helped me.
ReplyDelete