Class PdfXfaFieldCollection
Represents the field collection of the XFA form.
Implements
System.Collections.IEnumerable
Namespace: Syncfusion.Pdf.Xfa
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfXfaFieldCollection : PdfCollection, IEnumerable
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaTextBoxField field = new PdfXfaTextBoxField("textBox1", new SizeF(200, 30));
//Set text.
field.Text = "Text Box Field.";
//Get the fields collection.
PdfXfaFieldCollection collection = form.Fields;
//Add the field to the collection.
collection.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaTextBoxField("textBox1", New SizeF(200, 30))
'Set text.
field.Text = "Text Box Field."
'Get the fields collection.
Dim collection As PdfXfaFieldCollection = form.Fields
'Add the field to the collection.
collection.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Constructors
PdfXfaFieldCollection()
Declaration
public PdfXfaFieldCollection()
Properties
Count
Get the fields count.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaTextBoxField field = new PdfXfaTextBoxField("textBox1", new SizeF(200, 30));
//Set text.
field.Text = "Text Box Field.";
//Get the fields collection.
PdfXfaFieldCollection collection = form.Fields;
//Add the field to the collection.
collection.Add(field);
//Get the fields count.
int count = collection.Count;
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaTextBoxField("textBox1", New SizeF(200, 30))
'Set text.
field.Text = "Text Box Field."
'Get the fields collection.
Dim collection As PdfXfaFieldCollection = form.Fields
'Add the field to the collection.
collection.Add(field)
'Get the fields count.
Dim count As Integer = collection.Count
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Item[Int32]
Get the field with the specific index.
Declaration
public PdfXfaField this[int offset] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | offset | index. |
Property Value
Type | Description |
---|---|
PdfXfaField | PdfXfaField. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaTextBoxField field = new PdfXfaTextBoxField("textBox1", new SizeF(200, 30));
//Set text.
field.Text = "Text Box Field.";
//Get the fields collection.
PdfXfaFieldCollection collection = form.Fields;
//Add the field to the collection.
collection.Add(field);
//Get the specific field by index.
PdfXfaField field1 = collection[0];
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaTextBoxField("textBox1", New SizeF(200, 30))
'Set text.
field.Text = "Text Box Field."
'Get the fields collection.
Dim collection As PdfXfaFieldCollection = form.Fields
'Add the field to the collection.
collection.Add(field)
'Get specific field by index.
Dim field1 As PdfXfaField = collection(0)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Methods
Add(PdfXfaField)
Adds the specified field.
Declaration
public void Add(PdfXfaField field)
Parameters
Type | Name | Description |
---|---|---|
PdfXfaField | field | The field item which is added in the PDF XFA form. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaTextBoxField field = new PdfXfaTextBoxField("textBox1", new SizeF(200, 30));
//Set text.
field.Text = "Text Box Field.";
//Get the fields collection.
PdfXfaFieldCollection collection = form.Fields;
//Add the field to the collection.
collection.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaTextBoxField("textBox1", New SizeF(200, 30))
'Set text.
field.Text = "Text Box Field."
'Get the fields collection.
Dim collection As PdfXfaFieldCollection = form.Fields
'Add the field to the collection.
collection.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Clear()
Clear all the fields.
Declaration
public void Clear()
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaTextBoxField field = new PdfXfaTextBoxField("textBox1", new SizeF(200, 30));
//Set text.
field.Text = "Text Box Field.";
//Get the fields collection.
PdfXfaFieldCollection collection = form.Fields;
//Add the field to the collection.
collection.Add(field);
//Clear the fields.
collection.Clear();
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaTextBoxField("textBox1", New SizeF(200, 30))
'Set text.
field.Text = "Text Box Field."
'Get the fields collection.
Dim collection As PdfXfaFieldCollection = form.Fields
'Add the field to the collection.
collection.Add(field)
'Clear the fields.
collection.Clear()
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
IndexOf(PdfXfaField)
Determines the index of a specific field.
Declaration
public int IndexOf(PdfXfaField field)
Parameters
Type | Name | Description |
---|---|---|
PdfXfaField | field | The field. |
Returns
Type | Description |
---|---|
System.Int32 | Retruns the index of the specific field. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaTextBoxField field = new PdfXfaTextBoxField("textBox1", new SizeF(200, 30));
//Set text.
field.Text = "Text Box Field.";
//Get the fields collection.
PdfXfaFieldCollection collection = form.Fields;
//Add the field to the collection.
collection.Add(field);
//Get the field index.
int index = collection.IndexOf(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaTextBoxField("textBox1", New SizeF(200, 30))
'Set text.
field.Text = "Text Box Field."
'Get the fields collection.
Dim collection As PdfXfaFieldCollection = form.Fields
'Add the field to the collection.
collection.Add(field)
'Get the field index.
Dim index As Integer = collection.IndexOf(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
insert(Int32, PdfXfaField)
Insert field to the specified index.
Declaration
public void insert(int index, PdfXfaField field)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the field to be inserted in the collection. |
PdfXfaField | field | The field to be inserted in the collection. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaTextBoxField field = new PdfXfaTextBoxField("textBox1", new SizeF(200, 30));
//Set text.
field.Text = "Text Box Field.";
//Get the fields collection.
PdfXfaFieldCollection collection = form.Fields;
//Add the field to the collection.
collection.Add(field);
//Insert the field.
collection.Insert(0, field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaTextBoxField("textBox1", New SizeF(200, 30))
'Set text.
field.Text = "Text Box Field."
'Get the fields collection.
Dim collection As PdfXfaFieldCollection = form.Fields
'Add the field to the collection.
collection.Add(field)
'Insert the field.
collection.insert(0, field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Remove(PdfXfaField)
Remove the field.
Declaration
public void Remove(PdfXfaField field)
Parameters
Type | Name | Description |
---|---|---|
PdfXfaField | field | The field to be removed by the current collection. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaTextBoxField field = new PdfXfaTextBoxField("textBox1", new SizeF(200, 30));
//Set text.
field.Text = "Text Box Field.";
//Get the fields collection.
PdfXfaFieldCollection collection = form.Fields;
//Add the field to the collection.
collection.Add(field);
//Remove the field.
collection.Remove(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaTextBoxField("textBox1", New SizeF(200, 30))
'Set text.
field.Text = "Text Box Field."
'Get the fields collection.
Dim collection As PdfXfaFieldCollection = form.Fields
'Add the field to the collection.
collection.Add(field)
'Remove the field.
collection.Remove(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
RemoveAt(Int32)
Remove field at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the field to be removed by this collection. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaTextBoxField field = new PdfXfaTextBoxField("textBox1", new SizeF(200, 30));
//Set text.
field.Text = "Text Box Field.";
//Get the fields collection.
PdfXfaFieldCollection collection = form.Fields;
//Add the field to the collection.
collection.Add(field);
//Remove the field.
collection.RemoveAt(0);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaTextBoxField("textBox1", New SizeF(200, 30))
'Set text.
field.Text = "Text Box Field."
'Get the fields collection.
Dim collection As PdfXfaFieldCollection = form.Fields
'Add the field to the collection.
collection.Add(field)
'Remove the field.
collection.RemoveAt(0)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Implements
System.Collections.IEnumerable