philip89 wrote:

Hi There,
I want to know which of the fields (CHECKBOX, RADIOBUTTON,
TEXT, LIST, COMBO) are visible or not in a PDF file.
<>First let me give you some iText code:

PdfReader reader = new PdfReader(myPdf);
AcroFields fields = reader.getAcroFields();
AcroFields.Item item = fields.getFieldItem(myField);
PdfDictionary dict;
PdfName name;
for (Iterator i = item.merged.iterator(); i.hasNext(); ) {
 dict = (PdfDictionary)i.next();
 for (Iterator it = dict.getKeys().iterator(); it.hasNext(); ) {
   name = (PdfName)it.next();
   System.out.println(name.toString() + ": " + dict.get(name));
 }
}

With this code, you take a field defined in the String 'myField'
from a PDF defined in the String 'myPdf'.
This field can be represented on different pages, using different
widget annotations. All the properties of the field are bundled
in the AcroFields.Item object. For instance: a radio button field
with three radio buttons, will contain three widget annotation
dictionaries and three field annotation dictionaries.
In the code sample, we loop over all the elements in the 'merged'
member variable. This variable contains the combined dictionaries
(entries from the annotation + field dictionary).

To know if the field is visible or not, you need to check the entries
with visibility flags. You should look this up in the PDF Reference
manual. I don't know the value of the visibility flag by heart.
br,
Bruno


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to