Class PdfFormFieldCollection
- Namespace
- Syncfusion.Pdf.Interactive
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents a collection of form fields.
public class PdfFormFieldCollection : PdfFieldCollection, IEnumerable
- Inheritance
-
PdfFormFieldCollection
- Implements
- Inherited Members
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)
Remarks
This PdfFormFieldCollection class is used to get the collection of form fields. Please refer the UG docuemntation link
Constructors
PdfFormFieldCollection()
Initializes a new instance of the PdfFormFieldCollection class.
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.
protected override int DoAdd(PdfField field)
Parameters
field
PdfFieldThe field.
Returns
- See Also
DoClear()
Clears the collection.
protected override void DoClear()
- See Also
DoInsert(int, PdfField)
Inserts a filed into collection.
protected override void DoInsert(int index, PdfField field)
Parameters
- See Also
DoRemove(PdfField)
Removes the field from collection.
protected override void DoRemove(PdfField field)
Parameters
field
PdfFieldThe field.
- See Also
DoRemoveAt(int)
Removes the field at the specified position.
protected override void DoRemoveAt(int index)
Parameters
index
intThe index.
- See Also