Table of Contents

Class PdfLoadedXfaFieldCollection

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

Represents field collection of loaded XFA form.

public class PdfLoadedXfaFieldCollection : IEnumerable
Inheritance
PdfLoadedXfaFieldCollection
Implements
Inherited Members

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded text box field.
PdfLoadedXfaTextBoxField loadedTextBox = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["text[0]"] as PdfLoadedXfaTextBoxField;
//fill the text box
loadedTextBox.Text = "First Name";
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded text box field.
Dim loadedTextBox As PdfLoadedXfaTextBoxField = TryCast((TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)).Fields("text[0]"), PdfLoadedXfaTextBoxField)
'fill the text box
loadedTextBox.Text = "First Name"
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Constructors

PdfLoadedXfaFieldCollection()

Initializes a new instance of the PdfLoadedXfaFieldCollection class.

public PdfLoadedXfaFieldCollection()

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded text box field.
PdfLoadedXfaTextBoxField loadedTextBox = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["text[0]"] as PdfLoadedXfaTextBoxField;
//fill the text box
loadedTextBox.Text = "First Name";
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded text box field.
Dim loadedTextBox As PdfLoadedXfaTextBoxField = TryCast((TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)).Fields("text[0]"), PdfLoadedXfaTextBoxField)
'fill the text box
loadedTextBox.Text = "First Name"
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Properties

Count

Gets the field count.

public int Count { get; }

Property Value

int

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the fields count.
int count = loadedForm.Fields.Count;
//Get the loaded text box field.
PdfLoadedXfaTextBoxField loadedTextBox = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["text[0]"] as PdfLoadedXfaTextBoxField;
//fill the text box
loadedTextBox.Text = "First Name";
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Gets the fiels count.
Dim count As Integer = loadedForm.Fields.Count
'Get the loaded text box field.
Dim loadedTextBox As PdfLoadedXfaTextBoxField = TryCast((TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)).Fields("text[0]"), PdfLoadedXfaTextBoxField)
'fill the text box
loadedTextBox.Text = "First Name"
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

this[string]

Returns field with specified name.

public PdfLoadedXfaField this[string fieldName] { get; }

Parameters

fieldName string

Property Value

PdfLoadedXfaField

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded text box field.
PdfLoadedXfaTextBoxField loadedTextBox = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["text[0]"] as PdfLoadedXfaTextBoxField;
//fill the text box
loadedTextBox.Text = "First Name";
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded text box field.
Dim loadedTextBox As PdfLoadedXfaTextBoxField = TryCast((TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)).Fields("text[0]"), PdfLoadedXfaTextBoxField)
'fill the text box
loadedTextBox.Text = "First Name"
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Methods

Add(PdfXfaField)

Add new XFA form fields.

public void Add(PdfXfaField xfaField)

Parameters

xfaField PdfXfaField

The XFA form field to be added in the collection.

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("invoice.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Create a new PdfXfaField.
PdfXfaTextBoxField field = new PdfXfaTextBoxField("text1", new SizeF(100, 20));
field.Caption.Text = "Text Field";
//Add the text box field to existing field collection.
loadedForm.Fields.Add(field);
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("invoice.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Create a new PdfXfaField.
Dim field As New PdfXfaTextBoxField("text1", New SizeF(100, 20))
field.Caption.Text = "Text Field"
'Add the text box field to existing field collection.
loadedForm.Fields.Add(field)
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Clear()

Clear all the fields.

public void Clear()

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Crear all the fields.
loadedForm.Fields.Clear();
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Clear all the fields.
loadedForm.Fields.Clear()
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

GetEnumerator()

Returns an enumerator that iterates through a collection.

public IEnumerator GetEnumerator()

Returns

IEnumerator

Returns an enumerator that iterates through a collection.

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("invoice.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
foreach (PdfLoadedXfaField field in loadedForm.Fields)
{
if(field is PdfLoadedXfaTextBoxField)
{
(field as PdfLoadedXfaTextBoxField).Text = "Test";
}
}
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("invoice.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
For Each field As PdfLoadedXfaField In loadedForm.Fields
If TypeOf field Is PdfLoadedXfaTextBoxField Then
TryCast(field, PdfLoadedXfaTextBoxField).Text = "Test"
End If
Next
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Remove(PdfLoadedXfaField)

Remove the specified XFA field.

public void Remove(PdfLoadedXfaField lField)

Parameters

lField PdfLoadedXfaField

The lField item which is to be removed to the XFA form.

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
PdfLoadedXfaForm subform1 = loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm;
//Get the loaded text box field.
PdfLoadedXfaTextBoxField loadedTextBox = subform1.Fields["text[0]"] as PdfLoadedXfaTextBoxField;
//Remove the field.
subform1.Remove(loadedTextBox);
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
Dim subform1 As PdfLoadedXfaForm = (TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)
'Get the loaded text box field.
Dim loadedTextBox As PdfLoadedXfaTextBoxField = TryCast(subform1.Fields("text[0]"), PdfLoadedXfaTextBoxField)
'Remove the field.
subform1.Remove(loadedTextBox)
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

RemoveAt(int)

Remove the field with specific index.

public void RemoveAt(int index)

Parameters

index int

The index of the field has been removed.

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Remove the field at index.
loadedForm.Fields.RemoveAt(1);
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Remove the field at index.
loadedForm.RemoveAt(1)
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()