Eric Lou wrote:
> Dear Experts,
>
> as we know, if we want to create a textfield with multi lines, we can
> use some codes like:
>
> TextField tf = new TextField(writer, new Rectangle(0, 0,200, 100),
> "myTextField");
> tf.setOptions(TextField.MULTILINE );
>
>
> but, is there any way to know whether a text field is multi-lines when we
> read it?
Try this:
AcroFields form = stamper.getAcroFields();
PdfDictionary dict = form.getFieldItem("myTextField").getMerged(0);
PdfNumber fieldflags = dict.getAsNumber(PdfName.FF);
int flags = fieldflags.intValue();
if ((flags & PdfFormField.FF_MULTILINE) != 0)
System.out.println("Multiline!");
The code wasn't tested, I wrote it more or less from memory.
Let me know if it works; if not, I'll have to write an example.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
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/