menu

ASP.NET Core

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfLoadedFormFieldCollection

    Show / Hide Table of Contents

    Class PdfLoadedFormFieldCollection

    Represents field collection of loaded form.

    Inheritance
    System.Object
    PdfCollection
    PdfFieldCollection
    PdfLoadedFormFieldCollection
    Implements
    System.Collections.IEnumerable
    Inherited Members
    PdfFieldCollection.Add(PdfField)
    PdfFieldCollection.Insert(Int32, PdfField)
    PdfFieldCollection.Contains(PdfField)
    PdfFieldCollection.IndexOf(PdfField)
    PdfFieldCollection.Remove(PdfField)
    PdfFieldCollection.RemoveAt(Int32)
    PdfFieldCollection.Clear()
    PdfFieldCollection.DoAdd(PdfXfaForm, String)
    PdfCollection.GetEnumerator()
    PdfCollection.Count
    PdfCollection.List
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Pdf.Parsing
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfLoadedFormFieldCollection : PdfFieldCollection, IEnumerable, IPdfWrapper
    Examples
     //Load an existing document
     PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
     // PDF loaded field collection
     PdfLoadedFormFieldCollection fieldCollection = doc.Form.Fields;
     // Remove the first field 
     fieldCollection.RemoveAt(0);
     doc.Save("Form.pdf");
     doc.Close(true);
     'Load an existing document
     Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
     ' PDF loaded field collection
     Dim fieldCollection As PdfLoadedFormFieldCollection = doc.Form.Fields
     ' Remove the first field 
     fieldCollection.RemoveAt(0)
     doc.Save("Form.pdf")
     doc.Close(True)

    Constructors

    PdfLoadedFormFieldCollection()

    Initialize the new instance of the PdfLoadedFormFieldCollection class.

    Declaration
    public PdfLoadedFormFieldCollection()

    PdfLoadedFormFieldCollection(PdfLoadedForm)

    Initializes a new instance of the PdfLoadedFormFieldCollection class with the specific PdfLoadedForm.

    Declaration
    public PdfLoadedFormFieldCollection(PdfLoadedForm form)
    Parameters
    Type Name Description
    PdfLoadedForm form

    The PDF loaded form.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("Form.pdf");
    //Load the existing PDF form.
    PdfLoadedForm form = doc.Form;
    //Create a new form fields collection instance.
    PdfLoadedFormFieldCollection collection = new PdfLoadedFormFieldCollection(form);
    //Remove field.
    collection.RemoveAt(0);
    //Save and close the document.
    doc.Save("output.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As New PdfLoadedDocument("Form.pdf")
    'Load the existing PDF form.
    Dim form As PdfLoadedForm = doc.Form
    'Create a new form fields collection instance.
    Dim collection As New PdfLoadedFormFieldCollection(form)
    'Remove field.
    collection.RemoveAt(0)
    'Save and close the document.
    doc.Save("output.pdf")
    doc.Close(True)

    Properties

    Form

    Gets or sets the form.

    Declaration
    public PdfLoadedForm Form { get; set; }
    Property Value
    Type Description
    PdfLoadedForm
    Examples
    // Loads an existing PDF document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Load the FirstTextBox field
    PdfField field = doc.Form.Fields["FirstTextBox"];
    field.Flatten = true;
    doc.Save("Form.pdf");
    doc.Close(true);
     // Loads an existing PDF document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Load the FirstTextBox field
    Dim field As PdfField = doc.Form.Fields("FirstTextBox")
    field.Flatten = True
    doc.Save("Form.pdf")
    doc.Close(True)

    Item[Int32]

    Gets the PdfField at the specified index.[Read-Only]

    Declaration
    public override PdfField this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    Type Description
    PdfField
    Overrides
    PdfFieldCollection.Item[Int32]
    Examples
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    //load the form fields
    foreach (PdfField field in doc.Form.Fields)
    {
      // Flatten the form
      field.Flatten = true;
    }
    doc.Save("Form.pdf");
    doc.Close(true);
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    'load the form fields
    For Each field As PdfField In doc.Form.Fields
      ' Flatten the form
      field.Flatten = True
    Next field
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument

    Item[String]

    Returns field with specified name.[Read-Only]

    Declaration
    public PdfField this[string name] { get; }
    Parameters
    Type Name Description
    System.String name

    The specified field name.

    Property Value
    Type Description
    PdfField
    Examples
    // Loads an existing PDF document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Load the FirstTextBox field
    PdfField field = doc.Form.Fields["FirstTextBox"];
    field.Flatten = true;
    doc.Save("Form.pdf");
    doc.Close(true);
     // Loads an existing PDF document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Load the FirstTextBox field
    Dim field As PdfField = doc.Form.Fields("FirstTextBox")
    field.Flatten = True
    doc.Save("Form.pdf")
    doc.Close(True)

    Methods

    DoAdd(PdfField)

    Adds a field to collection.

    Declaration
    protected override int DoAdd(PdfField field)
    Parameters
    Type Name Description
    PdfField field

    The field.

    Returns
    Type Description
    System.Int32
    Overrides
    PdfFieldCollection.DoAdd(PdfField)

    DoClear()

    Clears the collection.

    Declaration
    protected override void DoClear()
    Overrides
    PdfFieldCollection.DoClear()

    DoInsert(Int32, PdfField)

    Inserts a filed into collection.

    Declaration
    protected override void DoInsert(int index, PdfField field)
    Parameters
    Type Name Description
    System.Int32 index

    The index.

    PdfField field

    The field.

    Overrides
    PdfFieldCollection.DoInsert(Int32, PdfField)

    DoRemove(PdfField)

    Removes the field from collection.

    Declaration
    protected override void DoRemove(PdfField field)
    Parameters
    Type Name Description
    PdfField field

    The field.

    Overrides
    PdfFieldCollection.DoRemove(PdfField)

    DoRemoveAt(Int32)

    Removes the field at the specified position.

    Declaration
    protected override void DoRemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The index.

    Overrides
    PdfFieldCollection.DoRemoveAt(Int32)

    TryGetField(String, out PdfLoadedField)

    Gets the form field with the given field name

    Declaration
    public bool TryGetField(string fieldName, out PdfLoadedField field)
    Parameters
    Type Name Description
    System.String fieldName

    Name of the field

    PdfLoadedField field

    Loaded Form Field

    Returns
    Type Description
    System.Boolean

    True, if form field exists, else False.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("Form.pdf");
    //Load the existing PDF form.
    PdfLoadedFormFieldCollection fields = doc.Form.Fields;
    PdfLoadedField field = null;
    //Get the specific field by name.
    fields.TryGetField("fn", out field);
    //Set text.
    (field as PdfLoadedTextBoxField).Text = "Modified";
    //Save and close the document.
    doc.Save("output.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As New PdfLoadedDocument("Form.pdf")
    'Load the existing PDF form.
    Dim fields As PdfLoadedFormFieldCollection = doc.Form.Fields
    Dim field As PdfLoadedField = Nothing
    'Get the specific field by name.
    fields.TryGetField("fn", field)
    'Set text.
    TryCast(field, PdfLoadedTextBoxField).Text = "Modified"
    'Save and close the document.
    doc.Save("output.pdf")
    doc.Close(True) 

    TryGetValue(String, out String)

    Gets the filed value from the given field name

    Declaration
    public bool TryGetValue(string fieldName, out string fieldValue)
    Parameters
    Type Name Description
    System.String fieldName

    Name of the loaded form filed

    System.String fieldValue

    Value of the field

    Returns
    Type Description
    System.Boolean

    True, if form field exists with the specific name, else False.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("Form.pdf");
    //Load the existing PDF form.
    PdfLoadedFormFieldCollection fields = doc.Form.Fields;
    string fieldValue = null;
    //Get the specific field value by name.
    fields.TryGetValue("fn", out fieldValue);  
    //Save and close the document.
    doc.Save("output.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As New PdfLoadedDocument("Form.pdf")
    'Load the existing PDF form.
    Dim fields As PdfLoadedFormFieldCollection = doc.Form.Fields
    Dim fieldValue As String = Nothing
    'Get the specific field value by name.
    fields.TryGetValue("fn", fieldValue)
    'Save and close the document.
    doc.Save("output.pdf")
    doc.Close(True) 

    ValidateSignatures(PdfSignatureValidationOptions, out List<PdfSignatureValidationResult>)

    Declaration
    public bool ValidateSignatures(PdfSignatureValidationOptions options, out List<PdfSignatureValidationResult> results)
    Parameters
    Type Name Description
    PdfSignatureValidationOptions options
    System.Collections.Generic.List<PdfSignatureValidationResult> results
    Returns
    Type Description
    System.Boolean

    ValidateSignatures(out List<PdfSignatureValidationResult>)

    Declaration
    public bool ValidateSignatures(out List<PdfSignatureValidationResult> results)
    Parameters
    Type Name Description
    System.Collections.Generic.List<PdfSignatureValidationResult> results
    Returns
    Type Description
    System.Boolean

    ValidateSignatures(X509Certificate2Collection, PdfSignatureValidationOptions, out List<PdfSignatureValidationResult>)

    Declaration
    public bool ValidateSignatures(X509Certificate2Collection rootCertificates, PdfSignatureValidationOptions options, out List<PdfSignatureValidationResult> results)
    Parameters
    Type Name Description
    System.Security.Cryptography.X509Certificates.X509Certificate2Collection rootCertificates
    PdfSignatureValidationOptions options
    System.Collections.Generic.List<PdfSignatureValidationResult> results
    Returns
    Type Description
    System.Boolean

    ValidateSignatures(X509Certificate2Collection, out List<PdfSignatureValidationResult>)

    Declaration
    public bool ValidateSignatures(X509Certificate2Collection rootCertificates, out List<PdfSignatureValidationResult> results)
    Parameters
    Type Name Description
    System.Security.Cryptography.X509Certificates.X509Certificate2Collection rootCertificates
    System.Collections.Generic.List<PdfSignatureValidationResult> results
    Returns
    Type Description
    System.Boolean

    Implements

    System.Collections.IEnumerable

    See Also

    PdfFieldCollection
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved