Class PdfLoadedForm
Represents Loaded form of the PDF document.
Inherited Members
Namespace: Syncfusion.Pdf.Parsing
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfLoadedForm : PdfForm, IPdfWrapper
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
//load the form field
PdfLoadedField field = form.Fields[0] as PdfLoadedField;
field.Export = true;
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
'load the form field
Dim field As PdfLoadedField = TryCast(form.Fields(0), PdfLoadedField)
field.Export = True
doc.Save("Form.pdf")
doc.Close(True)
Properties
EnableXfaFormFill
Enabling this property will fill both the AcroForm and XFA fields, and disabling this property will fill only AcroForm fields.
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm loadedForm = doc.Form;
//Set EnableXfaForm
loadedForm.EnableXfaFormFill = true;
PdfLoadedTextBoxField loadedTextBoxFieldDate = loadedForm.Fields[0] as PdfLoadedTextBoxField;
loadedTextBoxFieldDate.Text = "PDF";
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
'Set the form as read only
form.EnableXfaFormFill = True
Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
ldField.Text = "PDF"
doc.Save("Form.pdf")
doc.Close(True)
Declaration
public bool EnableXfaFormFill { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ExportEmptyFields
Gets or sets the ExportEmptyFields property, enabling this will export the empty acroform fields.
//Load an existing document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
// Load an existing form
PdfLoadedForm loadedForm = loadedDocument.Form;
//Export empty fields
loadedForm.ExportEmptyFields = true;
//Export the existing PDF document to XML file
loadedForm.ExportData("Output.xml", DataFormat.Xml, @"AcroForm1");
//Close the document
loadedDocument.Close(true);
'Load an existing document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Load the existing form
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
'Export empty fields
loadedForm.ExportEmptyFields = True
'Export the existing PDF document to XML file
loadedForm.ExportData("Output.xml", DataFormat.Xml, "AcroForm1")
loadedDocument.Close(True)
Declaration
public bool ExportEmptyFields { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Fields
Gets the field collection.[Read-Only]
Declaration
public PdfLoadedFormFieldCollection Fields { get; }
Property Value
Type | Description |
---|---|
PdfLoadedFormFieldCollection |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
//load the form field
PdfLoadedField field = form.Fields[0] as PdfLoadedField;
field.Export = true;
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
'load the form field
Dim field As PdfLoadedField = TryCast(form.Fields(0), PdfLoadedField)
field.Export = True
doc.Save("Form.pdf")
doc.Close(True)
See Also
ReadOnly
Gets or sets a value indicating whether the form is read only.
Declaration
public override bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the field is read-only, false otherwise. Default is false. |
Overrides
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
//Set the form as read only
form.ReadOnly = true;
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
'Set the form as read only
form.ReadOnly = True
doc.Save("Form.pdf")
doc.Close(True)
See Also
Methods
ExportData(Stream, DataFormat, String)
Export the form data to a stream with the specific DataFormat and form name.
Declaration
public void ExportData(Stream stream, DataFormat dataFormat, string formName)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
DataFormat | dataFormat | The format of exported data |
System.String | formName | The name of the PDF file the data is exported from |
Examples
// Loads an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
MemoryStream stream = new MemoryStream();
form.ExportData(stream, DataFormat.Xml, "SourceForm.pdf");
doc.Close(true);
' Loads an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
Dim stream As MemoryStream = New MemoryStream()
form.ExportData(stream, DataFormat.Xml, "SourceForm.pdf")
doc.Close(True)
ExportData(String, DataFormat, String)
Export the form data to a file with the specific DataFormat and form name.
Declaration
public void ExportData(string fileName, DataFormat dataFormat, string formName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the document which is need to export. |
DataFormat | dataFormat | The format of exported data. |
System.String | formName | The name of the PDF file the data is exported from. |
Examples
// Loads an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
form.ExportData("Export.xml", DataFormat.Xml, "SourceForm.pdf");
doc.Close(true);
' Loads an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
form.ExportData("Export.xml", DataFormat.Xml, "SourceForm.pdf")
doc.Close(True)
HighlightFields(Boolean)
Sets or resets the form field highlight option.
Declaration
public void HighlightFields(bool highlight)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | highlight |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
form.HighlightFields(true);
doc.Save("output.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
form.HighlightFields(True)
doc.Save("output.pdf")
doc.Close(True)
ImportData(Byte[], DataFormat)
Imports the form data from the file with the specific DataFormat.
Declaration
public void ImportData(byte[] array, DataFormat dataFormat)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | array | Array data of the file. |
DataFormat | dataFormat | The data format. |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
byte[] array = System.IO.File.ReadAllBytes("ImportData.xml");
form.ImportData(array,DataFormat.Xml);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
Dim array as byte[] =System.IO.File.ReadAllBytes("ImportData.xml")
form.ImportData(array,DataFormat.Xml)
doc.Save("Import.pdf")
doc.Close(True)
ImportData(Byte[], DataFormat, Boolean)
Imports the form data from the file with the specific DataFormat.
Declaration
public PdfLoadedFieldImportError[] ImportData(byte[] array, DataFormat dataFormat, bool errorFlag)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | array | Array data of the file. |
DataFormat | dataFormat | The data format. |
System.Boolean | errorFlag | if it is error flag, set to |
Returns
Type | Description |
---|---|
PdfLoadedFieldImportError[] | Error messages wile importing. |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
byte[] array = System.IO.File.ReadAllBytes("ImportData.xml");
form.ImportData("ImportData.xml",DataFormat.Xml, false);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
Dim array as byte[] =System.IO.File.ReadAllBytes("ImportData.xml")
form.ImportData(array,DataFormat.Xml, False)
doc.Save("Import.pdf")
doc.Close(True)
ImportData(String, DataFormat)
Imports the form data from the file with the specific DataFormat.
Declaration
public void ImportData(string fileName, DataFormat dataFormat)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file. |
DataFormat | dataFormat | The data format. |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
form.ImportData("ImportData.xml",DataFormat.Xml);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
form.ImportData("ImportData.xml",DataFormat.Xml)
doc.Save("Import.pdf")
doc.Close(True)
ImportData(String, DataFormat, Boolean)
Imports the form data from the file with the specific DataFormat.
Declaration
public PdfLoadedFieldImportError[] ImportData(string fileName, DataFormat dataFormat, bool errorFlag)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file. |
DataFormat | dataFormat | The data format. |
System.Boolean | errorFlag | if it is error flag, set to |
Returns
Type | Description |
---|---|
PdfLoadedFieldImportError[] | Error messages wile importing. |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
form.ImportData("ImportData.xml",DataFormat.Xml, false);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
form.ImportData("ImportData.xml",DataFormat.Xml, False)
doc.Save("Import.pdf")
doc.Close(True)
ImportDataFDF(Byte[])
Import form data from FDF file.
Declaration
public void ImportDataFDF(byte[] array)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | array | Array data of the fdf file. |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
// Load the FDF file
byte[] array = System.IO.File.ReadAllBytes("ImportFDF.fdf");
// Import the FDF stream
form.ImportDataFDF(array);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
' Load the FDF file
Dim array As byte[] = System.IO.File.ReadAllBytes("ImportFDF.fdf")
' Import the FDF stream
form.ImportDataFDF(array)
doc.Save("Import.pdf")
doc.Close(True)
ImportDataFDF(Stream)
Import form data from FDF file.
Declaration
public void ImportDataFDF(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The FDF file stream |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
// Load the FDF file
FileStream stream = new FileStream("ImportFDF.fdf", FileMode.Open);
// Import the FDF stream
form.ImportDataFDF(stream);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
' Load the FDF file
Dim stream As FileStream = New FileStream("ImportFDF.fdf", FileMode.Open)
' Import the FDF stream
form.ImportDataFDF(stream)
doc.Save("Import.pdf")
doc.Close(True)
ImportDataFDF(Stream, Boolean)
Import form data from FDF file.
Declaration
public PdfLoadedFieldImportError[] ImportDataFDF(Stream stream, bool continueImportOnError)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The FDF file stream |
System.Boolean | continueImportOnError | False if the import should stop on the first field that generates an error, or true if the import should ignore the error and continue with the next field. |
Returns
Type | Description |
---|---|
PdfLoadedFieldImportError[] | Error messages wile importing. |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
// Load the FDF file
FileStream stream = new FileStream("ImportFDF.fdf", FileMode.Open);
// Import the FDF stream
form.ImportDataFDF(stream,true);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
' Load the FDF file
Dim stream As FileStream = New FileStream("ImportFDF.fdf", FileMode.Open)
' Import the FDF stream
form.ImportDataFDF(stream,True)
doc.Save("Import.pdf")
doc.Close(True)
ImportDataJson(Byte[])
Import form data from Json file.
Declaration
public void ImportDataJson(byte[] array)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | array | Array data of Json file |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
byte[] array = System.IO.File.ReadAllBytes(ImportJSON.json);
// Import the JSON file
form.ImportDataJson(array);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
Dim array as byte[]=System.IO.File.ReadAllBytes(ImportJSON.json)
' Import the JSON file
form.ImportDataJson(array)
doc.Save("Import.pdf")
doc.Close(True)
ImportDataJson(Stream)
Import form data from Json file.
Declaration
public void ImportDataJson(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The Json file stream |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
// Load the Json file
FileStream stream = new FileStream("ImportJSON.json", FileMode.Open);
// Import the JSON file stream
form.ImportDataJson(stream);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
// Load the Json file
Dim stream As FileStream= new FileStream("ImportJSON.json", FileMode.Open)
' Import the JSON file stream
form.ImportDataJson(stream)
doc.Save("Import.pdf")
doc.Close(True)
ImportDataJson(String)
Import form data from Json file.
Declaration
public void ImportDataJson(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | The Json file |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
// Import the JSON file
form.ImportDataJson("ImportJSON.json");
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
' Import the JSON file
form.ImportDataJson("ImportJSON.json")
doc.Save("Import.pdf")
doc.Close(True)
ImportDataXFDF(Byte[])
Imports XFDF Data form the specific stream.
Declaration
public void ImportDataXFDF(byte[] array)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | array | Array data of the xfdf file. |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
// Load the XFDF file
byte[] array = System.IO.File.ReadAllBytes("ImportXFDF.xfdf");
// Import the XFDF stream
form.ImportDataXFDF(array);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
' Load the XFDF file
Dim array As byte[] = System.IO.File.ReadAllBytes("ImportXFDF.xfdf")
' Import the XFDF stream
form.ImportDataXFDF(array)
doc.Save("Import.pdf")
doc.Close(True)
ImportDataXFDF(Stream)
Imports XFDF Data form the specific stream.
Declaration
public void ImportDataXFDF(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
// Load the XFDF file
FileStream stream = new FileStream("ImportXFDF.xfdf", FileMode.Open);
// Import the XFDF stream
form.ImportDataXFDF(stream);
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
' Load the XFDF file
Dim stream As FileStream = New FileStream("ImportXFDF.xfdf", FileMode.Open)
' Import the XFDF stream
form.ImportDataXFDF(stream)
doc.Save("Import.pdf")
doc.Close(True)
ImportDataXFDF(String)
Imports XFDF Data from the specific file.
Declaration
public void ImportDataXFDF(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | The XFDF file path. |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
// Import the XFDF file.
form.ImportDataXFDF("ImportXFDF.xfdf");
doc.Save("Import.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
'Import the XFDF file.
form.ImportDataXFDF("ImportXFDF.xfdf")
doc.Save("Import.pdf")
doc.Close(True)
OnlyHexInString(String)
Called when [hex in string].
Declaration
public bool OnlyHexInString(string test)
Parameters
Type | Name | Description |
---|---|---|
System.String | test | The test string. |
Returns
Type | Description |
---|---|
System.Boolean |
Examples
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the existing form
PdfLoadedForm form = doc.Form;
bool isHex = form.OnlyHexInString("123456");
doc.Save("output.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the existing form
Dim form As PdfLoadedForm = doc.Form
Dim isHex As Boolean = form.OnlyHexInString("123456")
doc.Save("output.pdf")
doc.Close(True)