Table of Contents

Class PdfXfaFieldCollection

Namespace
Syncfusion.Pdf.Xfa
Assembly
Syncfusion.Pdf.Portable.dll

Represents the field collection of the XFA form.

public class PdfXfaFieldCollection : PdfCollection, IEnumerable
Inheritance
PdfXfaFieldCollection
Implements
Inherited Members

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

public PdfXfaFieldCollection()

Properties

Count

Get the fields count.

public int Count { get; }

Property Value

int

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

this[int]

Get the field with the specific index.

public PdfXfaField this[int offset] { get; }

Parameters

offset int

index.

Property Value

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.

public void Add(PdfXfaField field)

Parameters

field PdfXfaField

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.

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.

public int IndexOf(PdfXfaField field)

Parameters

field PdfXfaField

The field.

Returns

int

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

Remove(PdfXfaField)

Remove the field.

public void Remove(PdfXfaField field)

Parameters

field PdfXfaField

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

Remove field at the specified index.

public void RemoveAt(int index)

Parameters

index int

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

insert(int, PdfXfaField)

Insert field to the specified index.

public void insert(int index, PdfXfaField field)

Parameters

index int

The index of the field to be inserted in the collection.

field PdfXfaField

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