menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfFormFieldCollection - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfFormFieldCollection

    Represents a collection of form fields.

    Inheritance
    System.Object
    PdfCollection
    PdfFieldCollection
    PdfFormFieldCollection
    Implements
    System.Collections.IEnumerable
    Inherited Members
    PdfCollection.Count
    PdfCollection.GetEnumerator()
    PdfCollection.List
    PdfFieldCollection.Add(PdfField)
    PdfFieldCollection.Clear()
    PdfFieldCollection.Contains(PdfField)
    PdfFieldCollection.DoAdd(PdfXfaForm, String)
    PdfFieldCollection.IndexOf(PdfField)
    PdfFieldCollection.Insert(Int32, PdfField)
    PdfFieldCollection.Item[Int32]
    PdfFieldCollection.Item[String]
    PdfFieldCollection.Remove(PdfField)
    PdfFieldCollection.RemoveAt(Int32)
    Namespace: Syncfusion.Pdf.Interactive
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class PdfFormFieldCollection : PdfFieldCollection, IEnumerable, IPdfWrapper
    Remarks

    This PdfFormFieldCollection class is used to get the collection of form fields. Please refer the UG docuemntation link https://help.syncfusion.com/file-formats/pdf/working-with-forms#adding-the-combo-box-field for more details.

    Examples
    //Create a new PDf document
    PdfDocument document = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);          
    //Create a combo box
    PdfComboBoxField positionComboBox = new PdfComboBoxField(page, "positionComboBox");
    positionComboBox.Editable = true;
    positionComboBox.Bounds = new RectangleF(100, 115, 200, 20);
    positionComboBox.Font = font;
    positionComboBox.Editable = true;
    //Add it to document
    document.Form.Fields.Add(positionComboBox);
    PdfFieldCollection fieldCollection = document.Form.Fields;
    // Flatten the form collection
    for (int i = 0; i != fieldCollection.Count; i++)
    {
     fieldCollection[i].Flatten = true;
    }
    document.Save("Form.pdf");
    document.Close(true);
    'Create a new PDf document
    Dim document As New PdfDocument()
    'Creates a new page and adds it as the last page of the document
    Dim page As PdfPage = document.Pages.Add()
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12F)
    'Create a combo box
    Dim positionComboBox As New PdfComboBoxField(page, "positionComboBox")
    positionComboBox.Editable = True
    positionComboBox.Bounds = New RectangleF(100, 115, 200, 20)
    positionComboBox.Font = font
    positionComboBox.Editable = True
    'Add it to document
    document.Form.Fields.Add(positionComboBox)
    Dim fieldCollection As PdfFieldCollection = document.Form.Fields
    ' Flatten the form collection
    Dim i As Integer = 0
    While i != fieldCollection.Count
    	fieldCollection(i).Flatten = True
    	i += 1
    End While
    document.Save("Form.pdf")
    document.Close(True)

    Constructors

    PdfFormFieldCollection()

    Initializes a new instance of the PdfFormFieldCollection class.

    Declaration
    public PdfFormFieldCollection()
    Examples
    //Create a new PDf document
    PdfDocument document = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);          
    //Create a combo box
    PdfComboBoxField positionComboBox = new PdfComboBoxField(page, "positionComboBox");
    positionComboBox.Editable = true;
    positionComboBox.Bounds = new RectangleF(100, 115, 200, 20);
    positionComboBox.Font = font;
    positionComboBox.Editable = true;
    //Add it to document
    document.Form.Fields.Add(positionComboBox);
    PdfFieldCollection fieldCollection = new PdfFormFieldCollection();
    fieldCollection = document.Form.Fields;
    // Flatten the form collection
    for (int i = 0; i != fieldCollection.Count; i++)
    {
     fieldCollection[i].Flatten = true;
    }
    document.Save("Form.pdf");
    document.Close(true);
    'Create a new PDf document
    Dim document As New PdfDocument()
    'Creates a new page and adds it as the last page of the document
    Dim page As PdfPage = document.Pages.Add()
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12F)
    'Create a combo box
    Dim positionComboBox As New PdfComboBoxField(page, "positionComboBox")
    positionComboBox.Editable = True
    positionComboBox.Bounds = New RectangleF(100, 115, 200, 20)
    positionComboBox.Font = font
    positionComboBox.Editable = True
    'Add it to document
    document.Form.Fields.Add(positionComboBox)
    Dim fieldCollection As PdfFormFieldCollection = New PdfFormFieldCollection()
    fieldCollection = document.Form.Fields
    ' Flatten the form collection
    Dim i As Integer = 0
    While i != fieldCollection.Count
    	fieldCollection(i).Flatten = True
    	i += 1
    End While
    document.Save("Form.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfComboBoxField

    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
    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)

    Implements

    System.Collections.IEnumerable

    See Also

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