Flag values for hidden and invisible fields
I have to do processing for hidden and invisible fields. I went through the Flag values returned for invisible and hidden fields and came to conclusion that for hidden it should return 2 and for invisible it should return 1. But when I parsed PDF, it returned various values such as 96, 32, 6 for invisible fields. I also found that only consistent flag value returned was 4 for PRINT_ONLY (viewable) fields. Does anybody know the reason behind this.
I referred class com.lowagie.text.pdf.PdfAnnotation for flag values.
According to above API, for READ_ONLY fields it should return 64 but actually its 68.
Code snippet:
Item item = acrofields.getFieldItem(fieldName);
PdfDictionary dict;
PdfName name;
if (item!=null) {
ArrayList ar_list = item.merged;
if (ar_list!=null && ar_list.size()>0) {
for (Iterator i = ar_list.iterator(); i.hasNext();) {
dict = (PdfDictionary) i.next();
System.out.println((fieldName+" :: flag val: " + dict.get(PdfName.F)));
}
}
- Login to post comments

See ISO-32000-1 Table 165 Annotation flags
Submitted by Bruno Lowagie on Tue, 02/28/2012 - 16:17.You can download a version of ISO-32000-1 for free from the Adobe Website.
Go to page 385 and take a look at table 165.
I quote:
The value of the annotation dictionary's F entry is an integer interpreted as one-bit flags specifying various characteristics of the annotation. Bit positions within the flag word shall be numbered from low-order to high-order, with the lowest-order bit numbered 1. Table 165 shows the meanings of the flags; all other bits of the integer shall be set to 0.
You already found out that the print flag is 4 which is the third bit if you look at the flags from low-order to high-order. This is consistent with what you can find in table 165:
Bit position 1: Invisible
If set, do not display the annotation if it does not belong to one of the standard annotation types and no annotation handler is available. If clear, display such an unknown annotation using an appearance stream specified by its appearance dictionary, if any.
Bit position 2: Hidden
If set, do not display or print the annotation or allow it to interact with the user, regardless of its annotation type or whether an annotation handler is available.
NOTE 1: In cases where screen space is limited, the ability to hide and show annotations selectively can be used in combination with appearance streams to display auxiliary pop-up information similar in function to online help systems.
Bit position 3: Print
If set, print the annotation when the page is printed. If clear, never print the annotation, regardless of whether it is displayed on the screen.
NOTE 2: This can be useful for annotations representing interactive pushbuttons, which would serve no meaningful purpose on the printed page.
And so on...
Flag values for hidden and invisible fields
Submitted by minal.silimkar on Wed, 02/29/2012 - 13:01.Thanks for quick and detailed response.Will go through ISO-32000-1 Table 165 Annotation flag.