Field Classes

  • An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A PDF document may contain any number of Fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document.

    PDFNet fully supports reading, writing, and editing PDF forms and provides many utility methods so that work with forms is simple and efficient. Using PDFNet forms API arbitrary subsets of form fields can be imported or exported from the document, new forms can be created from scratch, and the appearance of existing forms can be modified.

    In PDFNet Fields are accessed through FieldIterator-s. The list of all Fields present in the document can be traversed as follows:

     FieldIterator itr = pdfdoc.GetFieldIterator();
     for(; itr.HasNext(); itr.Next()) {
       Field field = itr.Current();
       Console.WriteLine("Field name: {0}", field.GetName());
      }
    

    For a full sample, please refer to ‘InteractiveForms’ sample project.

    To search field by name use FieldFind method. For example:

     FieldIterator itr = pdfdoc.FieldFind("name");
     if (itr.HasNext()) {
       Console.WriteLine("Field name: {0}", itr.Current().GetName());
     }
     else { ...field was not found... }
    

    If a given field name was not found or if the end of the field list was reached the iterator HasNext() will return false.

    If you have a valid iterator you can access the Field using Current() method. For example: Field field = itr.Current();

    Using Flatten(…) method it is possible to merge field appearances with the page content. Form ‘flattening’ refers to the operation that changes active form fields into a static area that is part of the PDF document, just like the other text and images in the document. A completely flattened PDF form does not have any widget annotations or interactive fields.

    See more

    Declaration

    Objective-C

    @interface PTField : NSObject

    Swift

    class PTField : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PTFieldIterator : NSObject
    {
    
    
    }
    
    
    
    
    
    - (void)Next;
    - (PTField*)Current;
    - (BOOL)HasNext;
    - (instancetype)init;
    @end

    Swift

    class PTFieldIterator : NSObject