Q: Can you please tell me if is there a way to find out if a page
contains forms? (FDF).
I know that I can use a FieldIterator and then check for different
type of Fields, but I am interested at the PDF page level if it does
contain Forms.
-------
A: In case you are interested in forms annotations you should iterated
though all annotations on a given page (page.GetAnnot(idx) as shown in
Annotation sample project) and search for annotation with
Annot.Type.e_Widget type (returned by annot.GetType()). Given a widget
you can cast it and obtin corresponding form field as shown in the
following snippet:
int num_annots = page.GetNumAnnots();
for (int i=0; i<num_annots; ++i) {
Annot annot = page.GetAnnot(i);
if (annot.IsValid() == false) continue;
Rect bbox = annot.GetRect();
Console.WriteLine(" Position: {0:f}, {1:f}, {2:f}, {3:f}", bbox.x1,
bbox.y1, bbox.x2, bbox.y2);
if (annot.GetType() == Annot.Type.e_Widget) {
pdftron.PDF.Annots.Widget w=new pdftron.PDF.Annots.Widget(annot);
Field fld = w.GetField();
string name = fld.GetName();
...
}