Class PdfLoadedForm
Represents Loaded form of the PDF document.
Inherited Members
Namespace: Syncfusion.Pdf.Parsing
Assembly: Syncfusion.Pdf.Portable.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)
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)
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)
ImportDataXFDF(Byte[])
Declaration
public void ImportDataXFDF(byte[] array)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | array |
ImportDataXFDF(Stream)
Declaration
public void ImportDataXFDF(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream |
ImportDataXML(Byte[])
Declaration
public void ImportDataXML(byte[] array)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | array |
ImportDataXML(Stream)
Declaration
public void ImportDataXML(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream |
ImportDataXML(Stream, Boolean)
Declaration
public PdfLoadedFieldImportError[] ImportDataXML(Stream stream, bool continueImportOnError)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
System.Boolean | continueImportOnError |
Returns
Type | Description |
---|---|
PdfLoadedFieldImportError[] |
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)