Class PdfLoadedXfaForm
- Namespace
- Syncfusion.Pdf.Xfa
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents Loaded XFA form.
public class PdfLoadedXfaForm : PdfLoadedXfaField
- Inheritance
-
PdfLoadedXfaForm
- 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
PdfLoadedXfaForm()
public PdfLoadedXfaForm()
Properties
AreaNames
Get the area name of the form.
public string[] AreaNames { get; }
Property Value
- 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
public string[] CompleteFieldNames { get; }
Property Value
- 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
public string[] FieldNames { get; }
Property Value
- 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.
public PdfLoadedXfaFieldCollection Fields { get; set; }
Property Value
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
public float Height { get; set; }
Property Value
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
public PointF Location { get; set; }
Property Value
- 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
public bool ReadOnly { get; set; }
Property Value
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
public string[] SubFormNames { get; }
Property Value
- 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
public PdfXfaVisibility Visibility { get; set; }
Property Value
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
public float Width { get; set; }
Property Value
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.
public void ExportXfaData(Stream stream)
Parameters
stream
StreamThe 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.
public void ImportXfaData(Stream stream)
Parameters
stream
StreamThe 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
public PdfLoadedXfaField TryGetFieldByCompleteName(string name)
Parameters
name
stringComplete name of the field
Returns
- 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
public PdfLoadedXfaField[] TryGetFieldsByName(string name)
Parameters
name
stringName of the field
Returns
- 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()