Class PdfFormFieldCollection
Represents a collection of form fields.
Implements
System.Collections.IEnumerable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.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
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
DoClear()
Clears the collection.
Declaration
protected override void DoClear()
Overrides
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
DoRemove(PdfField)
Removes the field from collection.
Declaration
protected override void DoRemove(PdfField field)
Parameters
Type | Name | Description |
---|---|---|
PdfField | field | The field. |
Overrides
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
Implements
System.Collections.IEnumerable