Class PdfLoadedXfaFieldCollection
Represents field collection of loaded XFA form.
Inheritance
System.Object
PdfLoadedXfaFieldCollection
Implements
System.Collections.IEnumerable
Namespace: Syncfusion.Pdf.Xfa
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfLoadedXfaFieldCollection : Object, IEnumerable
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.
Declaration
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.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
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()
Item[String]
Returns field with specified name.
Declaration
public PdfLoadedXfaField this[string fieldName] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName |
Property Value
Type |
---|
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.
Declaration
public void Add(PdfXfaField xfaField)
Parameters
Type | Name | Description |
---|---|---|
PdfXfaField | xfaField | 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.
Declaration
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.
Declaration
public IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.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.
Declaration
public void Remove(PdfLoadedXfaField lField)
Parameters
Type | Name | Description |
---|---|---|
PdfLoadedXfaField | lField | 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(Int32)
Remove the field with specific index.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | 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()
Implements
System.Collections.IEnumerable