GemBox.Pdf
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    PdfFieldCollection Class

    Namespace:
    GemBox.Pdf.Forms
    Assembly:
    GemBox.Pdf.dll

    Represents a collection of all fields in an interactive form.

    • C#
    • VB.NET
    [ComVisible(false)]
    public sealed class PdfFieldCollection : PdfCollection<PdfField>, IList, ICollection, IList<PdfField>, ICollection<PdfField>, IReadOnlyList<PdfField>, IReadOnlyCollection<PdfField>, IEnumerable<PdfField>, IEnumerable
    <ComVisible(False)>
        Inherits PdfCollection(Of PdfField)
        Implements IList, ICollection, IList(Of PdfField), ICollection(Of PdfField), IReadOnlyList(Of PdfField), IReadOnlyCollection(Of PdfField), IEnumerable(Of PdfField), IEnumerable
    Inheritance:
    System.Object
    PdfObject
    PdfCollection
    PdfCollection<PdfField>
    PdfFieldCollection
    Implements
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.Generic.IList<PdfField>
    System.Collections.Generic.ICollection<PdfField>
    System.Collections.Generic.IReadOnlyList<PdfField>
    System.Collections.Generic.IReadOnlyCollection<PdfField>
    System.Collections.Generic.IEnumerable<PdfField>
    System.Collections.IEnumerable

    Properties

    Item[String]

    Gets the first occurrence of a PdfField with the specified (fully qualified) field name or null.

    • C#
    • VB.NET
    public PdfField this[string fieldName] { get; }
    Public ReadOnly Property Item(fieldName As String) As PdfField
    Parameters
    fieldName
    System.String

    The (fully qualified) name of the field.

    Property Value
    PdfField

    The first occurrence of a PdfField with the specified (fully qualified) field name or null.

    NewRadioButtonName

    Gets the name that will be applied to the newly created PdfRadioButtonField.

    • C#
    • VB.NET
    public string NewRadioButtonName { get; set; }
    Public Property NewRadioButtonName As String
    Property Value
    System.String

    The name that will be applied to the newly created PdfRadioButtonField.

    Methods

    AddButton(PdfPage, Double, Double, Double, Double)

    Adds a new PdfButtonField to the PdfFieldCollection.

    Its associated widget annotation will be added to the page and annotation's rectangle will be defined by left, bottom, width and height in default user space units.

    Its Name will be automatically set.

    • C#
    • VB.NET
    public PdfButtonField AddButton(PdfPage page, double left, double bottom, double width, double height)
    Public Function AddButton(page As PdfPage, left As Double, bottom As Double, width As Double, height As Double) As PdfButtonField
    Parameters
    page
    PdfPage

    The page on which the PdfButtonField's associated widget annotation will be added.

    left
    System.Double

    The lower-left horizontal coordinate of the PdfButtonField's associated widget annotation rectangle on page specified in default user space units.

    bottom
    System.Double

    The lower-left vertical coordinate of the PdfButtonField's associated widget annotation rectangle on page specified in default user space units.

    width
    System.Double

    The width of the PdfButtonField's associated widget annotation rectangle specified in default user space units.

    height
    System.Double

    The height of the PdfButtonField's associated widget annotation rectangle specified in default user space units.

    Returns
    PdfButtonField

    A new PdfButtonField added to the PdfFieldCollection.

    AddCheckBox(PdfPage, Double, Double, Double, Double)

    Adds a new PdfCheckBoxField to the PdfFieldCollection.

    Its associated widget annotation will be added to the page and annotation's rectangle will be defined by left, bottom, width and height in default user space units.

    Its Name will be automatically set.

    • C#
    • VB.NET
    public PdfCheckBoxField AddCheckBox(PdfPage page, double left, double bottom, double width, double height)
    Public Function AddCheckBox(page As PdfPage, left As Double, bottom As Double, width As Double, height As Double) As PdfCheckBoxField
    Parameters
    page
    PdfPage

    The page on which the PdfCheckBoxField's associated widget annotation will be added.

    left
    System.Double

    The lower-left horizontal coordinate of the PdfCheckBoxField's associated widget annotation rectangle on page specified in default user space units.

    bottom
    System.Double

    The lower-left vertical coordinate of the PdfCheckBoxField's associated widget annotation rectangle on page specified in default user space units.

    width
    System.Double

    The width of the PdfCheckBoxField's associated widget annotation rectangle specified in default user space units.

    height
    System.Double

    The height of the PdfCheckBoxField's associated widget annotation rectangle specified in default user space units.

    Returns
    PdfCheckBoxField

    A new PdfCheckBoxField added to the PdfFieldCollection.

    AddDropdown(PdfPage, Double, Double, Double, Double)

    Adds a new PdfDropdownField to the PdfFieldCollection.

    Its associated widget annotation will be added to the page and annotation's rectangle will be defined by left, bottom, width and height in default user space units.

    Its Name will be automatically set.

    • C#
    • VB.NET
    public PdfDropdownField AddDropdown(PdfPage page, double left, double bottom, double width, double height)
    Public Function AddDropdown(page As PdfPage, left As Double, bottom As Double, width As Double, height As Double) As PdfDropdownField
    Parameters
    page
    PdfPage

    The page on which the PdfDropdownField's associated widget annotation will be added.

    left
    System.Double

    The lower-left horizontal coordinate of the PdfDropdownField's associated widget annotation rectangle on page specified in default user space units.

    bottom
    System.Double

    The lower-left vertical coordinate of the PdfDropdownField's associated widget annotation rectangle on page specified in default user space units.

    width
    System.Double

    The width of the PdfDropdownField's associated widget annotation rectangle specified in default user space units.

    height
    System.Double

    The height of the PdfDropdownField's associated widget annotation rectangle specified in default user space units.

    Returns
    PdfDropdownField

    A new PdfDropdownField added to the PdfFieldCollection.

    AddImage(PdfPage, Double, Double, Double, Double)

    Adds a new PdfButtonField to the PdfFieldCollection.

    Its associated widget annotation will be added to the page and annotation's rectangle will be defined by left, bottom, width and height in default user space units.

    Its Name will be automatically set.

    • C#
    • VB.NET
    public PdfButtonField AddImage(PdfPage page, double left, double bottom, double width, double height)
    Public Function AddImage(page As PdfPage, left As Double, bottom As Double, width As Double, height As Double) As PdfButtonField
    Parameters
    page
    PdfPage

    The page on which the Image field's associated widget annotation will be added.

    left
    System.Double

    The lower-left horizontal coordinate of the Image field's associated widget annotation rectangle on page specified in default user space units.

    bottom
    System.Double

    The lower-left vertical coordinate of the Image field's associated widget annotation rectangle on page specified in default user space units.

    width
    System.Double

    The width of the Image field's associated widget annotation rectangle specified in default user space units.

    height
    System.Double

    The height of the Image field's associated widget annotation rectangle specified in default user space units.

    Returns
    PdfButtonField

    A new PdfButtonField added to the PdfFieldCollection.

    Remarks

    Image field is just a customized PdfButtonField.

    The most notable customizations are that its Name ends with an "_af_image" suffix, its Actions contains an instance of an PdfRunJavaScriptAction that imports an icon to the button, and its LabelPlacement is set to IconOnly.

    To set a PdfImage to the Image field, use the SetIcon(PdfImage, PdfAppearanceTrigger) method on the Image field's Appearance.

    AddListBox(PdfPage, Double, Double, Double, Double)

    Adds a new PdfListBoxField to the PdfFieldCollection.

    Its associated widget annotation will be added to the page and annotation's rectangle will be defined by left, bottom, width and height in default user space units.

    Its Name will be automatically set.

    • C#
    • VB.NET
    public PdfListBoxField AddListBox(PdfPage page, double left, double bottom, double width, double height)
    Public Function AddListBox(page As PdfPage, left As Double, bottom As Double, width As Double, height As Double) As PdfListBoxField
    Parameters
    page
    PdfPage

    The page on which the PdfListBoxField's associated widget annotation will be added.

    left
    System.Double

    The lower-left horizontal coordinate of the PdfListBoxField's associated widget annotation rectangle on page specified in default user space units.

    bottom
    System.Double

    The lower-left vertical coordinate of the PdfListBoxField's associated widget annotation rectangle on page specified in default user space units.

    width
    System.Double

    The width of the PdfListBoxField's associated widget annotation rectangle specified in default user space units.

    height
    System.Double

    The height of the PdfListBoxField's associated widget annotation rectangle specified in default user space units.

    Returns
    PdfListBoxField

    A new PdfListBoxField added to the PdfFieldCollection.

    AddRadioButton(PdfPage, Double, Double, Double, Double)

    Adds a new PdfRadioButtonField to the PdfFieldCollection.

    Its associated widget annotation will be added to the page and annotation's rectangle will be defined by left, bottom, width and height in default user space units.

    Its Name will be automatically set to the value of NewRadioButtonName.

    • C#
    • VB.NET
    public PdfRadioButtonField AddRadioButton(PdfPage page, double left, double bottom, double width, double height)
    Public Function AddRadioButton(page As PdfPage, left As Double, bottom As Double, width As Double, height As Double) As PdfRadioButtonField
    Parameters
    page
    PdfPage

    The page on which the PdfRadioButtonField's associated widget annotation will be added.

    left
    System.Double

    The lower-left horizontal coordinate of the PdfRadioButtonField's associated widget annotation rectangle on page specified in default user space units.

    bottom
    System.Double

    The lower-left vertical coordinate of the PdfRadioButtonField's associated widget annotation rectangle on page specified in default user space units.

    width
    System.Double

    The width of the PdfRadioButtonField's associated widget annotation rectangle specified in default user space units.

    height
    System.Double

    The height of the PdfRadioButtonField's associated widget annotation rectangle specified in default user space units.

    Returns
    PdfRadioButtonField

    A new PdfRadioButtonField added to the PdfFieldCollection.

    AddSignature()

    Adds a new invisible PdfSignatureField to the PdfFieldCollection.

    Its associated widget annotation will be added to the first page of the Pages and annotation's rectangle will have zero height and width, thus making the signature invisible.

    Its Name will be automatically set.

    • C#
    • VB.NET
    public PdfSignatureField AddSignature()
    Public Function AddSignature As PdfSignatureField
    Returns
    PdfSignatureField

    A new invisible PdfSignatureField added to the PdfFieldCollection.

    AddSignature(PdfPage, Double, Double, Double, Double)

    Adds a new visible PdfSignatureField to the PdfFieldCollection.

    Its associated widget annotation will be added to the page and annotation's rectangle will be defined by left, bottom, width and height in default user space units.

    Its Name will be automatically set.

    • C#
    • VB.NET
    public PdfSignatureField AddSignature(PdfPage page, double left, double bottom, double width, double height)
    Public Function AddSignature(page As PdfPage, left As Double, bottom As Double, width As Double, height As Double) As PdfSignatureField
    Parameters
    page
    PdfPage

    The page on which the PdfSignatureField's associated widget annotation will be added.

    left
    System.Double

    The lower-left horizontal coordinate of the PdfSignatureField's associated widget annotation rectangle on page specified in default user space units.

    bottom
    System.Double

    The lower-left vertical coordinate of the PdfSignatureField's associated widget annotation rectangle on page specified in default user space units.

    width
    System.Double

    The width of the PdfSignatureField's associated widget annotation rectangle specified in default user space units.

    height
    System.Double

    The height of the PdfSignatureField's associated widget annotation rectangle specified in default user space units.

    Returns
    PdfSignatureField

    A new visible PdfSignatureField added to the PdfFieldCollection.

    AddText(PdfPage, Double, Double, Double, Double)

    Adds a new PdfTextField to the PdfFieldCollection.

    Its associated widget annotation will be added to the page and annotation's rectangle will be defined by left, bottom, width and height in default user space units.

    Its Name will be automatically set.

    • C#
    • VB.NET
    public PdfTextField AddText(PdfPage page, double left, double bottom, double width, double height)
    Public Function AddText(page As PdfPage, left As Double, bottom As Double, width As Double, height As Double) As PdfTextField
    Parameters
    page
    PdfPage

    The page on which the PdfTextField's associated widget annotation will be added.

    left
    System.Double

    The lower-left horizontal coordinate of the PdfTextField's associated widget annotation rectangle on page specified in default user space units.

    bottom
    System.Double

    The lower-left vertical coordinate of the PdfTextField's associated widget annotation rectangle on page specified in default user space units.

    width
    System.Double

    The width of the PdfTextField's associated widget annotation rectangle specified in default user space units.

    height
    System.Double

    The height of the PdfTextField's associated widget annotation rectangle specified in default user space units.

    Returns
    PdfTextField

    A new PdfTextField added to the PdfFieldCollection.

    GetEnumerator()

    Returns an enumerator that iterates through the PdfFieldCollection.

    • C#
    • VB.NET
    public PdfFieldCollection.Enumerator GetEnumerator()
    Public Function GetEnumerator As PdfFieldCollection.Enumerator
    Returns
    PdfFieldCollection.Enumerator

    A PdfFieldCollection.Enumerator for the PdfFieldCollection.

    Refresh()

    Forces an update of the PdfFieldCollection to include all PdfFields contained in the Annotations of all Pages that are not already contained in the PdfFieldCollection.

    This method also handles the invalid AcroForm entry in the Catalog dictionary, updates the Page property of all PdfAnnotations in the PdfDocument, and removes the invalid Parent entry of all Field dictionaries in the PdfDocument.

    • C#
    • VB.NET
    public void Refresh()
    Public Sub Refresh

    Inherited Properties

    Count

    Gets the number of elements contained in the PdfCollection.

    (Inherited from PdfCollection)

    Metadata

    (Optional; PDF 1.4) A metadata stream containing metadata for the component.

    (Inherited from PdfObject)

    Inherited Methods

    Clear()

    Removes all elements from the PdfCollection.

    (Inherited from PdfCollection)

    RemoveAt(System.Int32)

    Removes the element at the specified index of the PdfCollection.

    (Inherited from PdfCollection)

    Implements

    System.Collections.IList
    System.Collections.ICollection
    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IReadOnlyList<T>
    System.Collections.Generic.IReadOnlyCollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable

    Extension Methods

    PdfObjectExtensions.GetDictionary(PdfObject)
    PdfObjectExtensions.GetOrAddDictionary(PdfObject)
    PdfObjectExtensions.GetArray(PdfObject)
    PdfObjectExtensions.GetArray(PdfCollection)
    PdfObjectExtensions.GetOrAddArray(PdfCollection)

    Examples

    Digital signature example
    Visible digital signature example

    See Also

    PDF Specification ISO 32000-1:2008, section '12.7 Interactive Forms'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.