Class PdfLoadedXfaForm
Represents Loaded XFA form.
Namespace: Syncfusion.Pdf.Xfa
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfLoadedXfaForm : 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()
Constructors
PdfLoadedXfaForm()
Declaration
public PdfLoadedXfaForm()
Properties
AreaNames
Get the area name of the form.
Declaration
public string[] AreaNames { get; }
Property Value
Type |
---|
System.String[] |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the area names.
string[] areaNames = loadedForm.AreaNames;
//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 area names.
Dim areaNames As String() = loadedForm.AreaNames
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
CompleteFieldNames
Get the complete names of the fields
Declaration
public string[] CompleteFieldNames { get; }
Property Value
Type |
---|
System.String[] |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the complete field names.
string[] completeFieldNames = loadedForm.CompleteFieldNames;
//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 complete field names.
Dim completeFieldNames As String() = loadedForm.CompleteFieldNames
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
FieldNames
Get all the field names
Declaration
public string[] FieldNames { get; }
Property Value
Type |
---|
System.String[] |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the field names.
string[] fieldNames = loadedForm.FieldNames;
//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 field names.
Dim fieldNames As String() = loadedForm.FieldNames
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
Fields
Represents loaded form fields collection.
Declaration
public PdfLoadedXfaFieldCollection Fields { get; set; }
Property Value
Type |
---|
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()
Height
Gets or sets the height
Declaration
public float Height { get; set; }
Property Value
Type |
---|
System.Single |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the form height.
float height = loadedForm.Height;
//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 form height.
Dim height As Single = loadedForm.Height
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
Location
Gets or sets the location
Declaration
public PointF Location { get; set; }
Property Value
Type |
---|
PointF |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the form location.
PointF location = loadedForm.Location;
//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 form location.
Dim loaction As PointF = loadedForm.Location
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
ReadOnly
Gets or sets the field is readonly
Declaration
public bool ReadOnly { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Set readonly.
loadedForm.ReadOnly = true;
//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
'Set readonly.
loadedForm.ReadOnly = True
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
SubFormNames
Gett all the subforms name
Declaration
public string[] SubFormNames { get; }
Property Value
Type |
---|
System.String[] |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the subform names.
string[] subformNames = loadedForm.SubFormNames;
//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 subform names.
Dim subformNames As String() = loadedForm.SubFormNames
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
Visibility
Gets or sets the visibility of the field
Declaration
public PdfXfaVisibility Visibility { get; set; }
Property Value
Type |
---|
PdfXfaVisibility |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Set visibility.
loadedForm.Visibility = PdfXfaVisibility.Visible;
//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
'Set visibility.
loadedForm.Visibility = PdfXfaVisibility.Visible
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
Width
Gets or sets the width
Declaration
public float Width { get; set; }
Property Value
Type |
---|
System.Single |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the form width.
float width = loadedForm.Width;
//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 form width.
Dim width As Single = loadedForm.Width
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
Methods
ExportXfaData(Stream)
Export XFA form data from Pdf document to a stream in XML format.
Declaration
public void ExportXfaData(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to export XFA form data |
Examples
//Load the XFA form document
PdfLoadedXfaDocument xfaDocument = new PdfLoadedXfaDocument(xfaFormFile);
//Create stream to export the data
MemoryStream stream = new MemoryStream();
//Export XFA data to xml format to stream
xfaDocument.XfaForm.ExportXfaData(stream);
//Save and close the XFA document
xfaDocument.Save("Output.pdf");
xfaDocument.Close();
'Load the XFA form document
Dim xfaDocument As PdfLoadedXfaDocument = New PdfLoadedXfaDocument(xfaFormFile)
'Create stream to export the data
Dim stream As MemoryStream = New MemoryStream()
'Export XFA data to xml format to stream
xfaDocument.XfaForm.ExportXfaData(stream)
'Save and close the XFA document
xfaDocument.Save("Output.pdf.pdf")
xfaDocument.Close()
stream.Dispose()
ImportXfaData(Stream)
Import XFA form data from stream to Pdf document.
Declaration
public void ImportXfaData(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream of XFA data to import |
Examples
//Load the XFA PDF document.
PdfLoadedXfaDocument xfaDocument = new PdfLoadedXfaDocument(xfaFormFile);
//Import XFA data from stream.
FileStream fileStream = new FileStream("Import.xml", FileMode.Open);
xfaDocument.XfaForm.ImportXfaData(fileStream);
//Save and Close the document.
xfaDocument.Save("Output.pdf");
xfaDocument.Close();
//Dispose the Stream.
fileStream.Dispose();
'Load the XFA form document
Dim xfaDocument As PdfLoadedXfaDocument = New PdfLoadedXfaDocument(xfaFormFile)
'Import XFA data from stream.
Dim fileStream As FileStream = New FileStream("Import.xml", FileMode.Open)
xfaDocument.XfaForm.ImportXfaData(fileStream)
'Save and Close the document.
xfaDocument.Save("Output.pdf")
xfaDocument.Close()
'Dispose the Stream.
fileStream.Dispose()
TryGetFieldByCompleteName(String)
Get the XFA field using complete field name
Declaration
public PdfLoadedXfaField TryGetFieldByCompleteName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Complete name of the field |
Returns
Type | Description |
---|---|
PdfLoadedXfaField | Return the XFA field |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("invoice.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get fields by name.
PdfLoadedXfaField field = loadedForm.TryGetFieldByCompleteName("form1[0].#subform[0].Header[0].InvoiceNumber[0]");
//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
'Get fields by name.
Dim fields As PdfLoadedXfaField() = loadedForm.TryGetFieldByCompleteName("form1[0].#subform[0].Header[0].InvoiceNumber[0]")
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()
TryGetFieldsByName(String)
Get the fields collection by field name
Declaration
public PdfLoadedXfaField[] TryGetFieldsByName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the field |
Returns
Type | Description |
---|---|
PdfLoadedXfaField[] | Collection of XFA fields |
Examples
//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("invoice.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get fields by name.
PdfLoadedXfaField[] fields = loadedForm.TryGetFieldsByName("InvoiceNumber[0]");
//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
'Get fields by name.
Dim fields As PdfLoadedXfaField() = loadedForm.TryGetFieldsByName("InvoiceNumber[0]")
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()