Hello,
i wrote simple method to add TextField to position, with specified text.
I have problem, when text is in utf-8 coding with some diacritical
characters (ľščťžřě).
Acrobat reader render bad these chars, also my Servlet got bad data from
acro button Submit. Is some possibility how to fix these diacritical
characters - methods:
ff.setValueAsString(text);
and
tf.setText(text);
Here is my code:
static public void addTextField(PdfStamper stamper,String name, String
text, Rectangle rect, int page) {
PdfFormField ff = PdfFormField.createTextField(stamper.getWriter(),
false,false,0);
ff.setFieldName(name);
ff.setValueAsString(text);
TextField tf = new TextField(stamper.getWriter(), rect, null);
tf.setBackgroundColor(Color.gray);
tf.setBorderColor(Color.black);
tf.setBorderWidth(1);
tf.setAlignment(Element.ALIGN_LEFT);
tf.setText(text);
tf.setOptions(TextField.READ_ONLY);
PdfFormField field1 = tf.getTextField();
field1.setFieldFlags(TextField.READ_ONLY);
ff.addKid(field1);
ff.setFieldFlags(PdfFormField.FF_READ_ONLY);
stamper.addAnnotation(ff, page);
}
Regards,
Pavol Behul.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/