WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfLoadedForm

    Show / Hide Table of Contents

    Class PdfLoadedForm

    Represents Loaded form of the PDF document.

    Inheritance
    System.Object
    PdfForm
    PdfLoadedForm
    Inherited Members
    PdfForm.SetDefaultAppearance(Boolean)
    PdfForm.ComplexScript
    PdfForm.IsDefaultEncoding
    PdfForm.Flatten
    PdfForm.FieldAutoNaming
    PdfForm.DisableAutoFormat
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    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
    PdfLoadedDocument
    PdfLoadedForm

    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
    PdfForm.ReadOnly
    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
    PdfLoadedDocument
    PdfLoadedForm

    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(Stream, ExportFormSettings)

    Export the form data to a stream with specified ExportFormSettings.

    Declaration
    public void ExportData(Stream stream, ExportFormSettings settings)
    Parameters
    Type Name Description
    System.IO.Stream stream
    ExportFormSettings settings
    Examples
    // Load an existing document
    PdfLoadedDocument loadedDocument = new PdfLoadedDocument("../../Data/ChineseValue.pdf");
    // Load an existing form
    PdfLoadedForm loadedForm = loadedDocument.Form;
    //Create new instance for export form settings.
    ExportFormSettings settings = new ExportFormSettings();
    //Gets or sets the data format to export form fields. 
    settings.DataFormat = DataFormat.Fdf;
    //Gets or sets the value that indicates the form name of the PDF form is export.
    settings.FormName   = "formname";
    MemoryStream stream = new MemoryStream();
    //Export the form data to a stream with specified ExportFormSettings.
    loadedForm.ExportData(stream, settings);
    //Save the PDF document
    loadedDocument.Save("ChineseValue.pdf");
    //close the document
    loadedDocument.Close(true);
    'Load an existing document
    Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("../../Data/ChineseValue.pdf")
    'Load an existing form
    Dim loadedForm As PdfLoadedForm = loadedDocument.Form
    'Create new instance for export form settings.
    Dim settings As ExportFormSettings = New ExportFormSettings()
    'Gets or sets the data format to export form fields. 
    settings.DataFormat = DataFormat.Fdf
    'Gets or sets the value that indicates the form name of the PDF form is export.
    settings.FormName   = "formname"
    'Export the existing PDF document to FDF file
    Dim stream As MemoryStream = New MemoryStream()
    'Export the form data to a stream with specified ExportFormSettings.
    loadedForm.ExportData(stream, settings)
    'Save the PDF document
    loadedDocument.Save("ChineseValue.pdf")
    'close the document
    loadedDocument.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)

    ExportData(String, ExportFormSettings)

    Export the form data to a file with specified ExportFormSettings.

    Declaration
    public void ExportData(string fileName, ExportFormSettings settings)
    Parameters
    Type Name Description
    System.String fileName
    ExportFormSettings settings
    Examples
    // Loads an existing document
    PdfLoadedDocument loadedDocument = new PdfLoadedDocument("../../Data/ChineseValue.pdf");
    // Load an existing form
    PdfLoadedForm loadedForm = loadedDocument.Form;
    //Create new instance for export form settings.
    ExportFormSettings settings = new ExportFormSettings();
    //Gets or sets the data format to export form fields. 
    settings.DataFormat = DataFormat.Fdf;
    //Gets or sets the value that indicates the form name of the PDF form is export.
    settings.FormName   = "formname";
    //Export the form data to a file with specified ExportFormSettings.
    loadedForm.ExportData("ChineseValue.Fdf", settings);
    //Save the PDF document
    loadedDocument.Save("ChineseValue.pdf");
    //close the document
    loadedDocument.Close(true);
    'Load an existing document
    Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("../../Data/ChineseValue.pdf")
    'Load an existing form
    Dim loadedForm As PdfLoadedForm = loadedDocument.Form
    'Create new instance for export form settings.
    Dim settings As ExportFormSettings = New ExportFormSettings()
    'Gets or sets the data format to export form fields. 
    settings.DataFormat = DataFormat.Fdf
    'Gets or sets the value that indicates the form name of the PDF form is export.
    settings.FormName   = "formname"
    'Export the form data to a file with specified ExportFormSettings.
    loadedForm.ExportData("ChineseValue.Fdf", settings)
    'Save the PDF document
    loadedDocument.Save("ChineseValue.pdf")
    'close the document
    loadedDocument.Close(True)

    FlattenFields()

    PDF provides support to flatten a form field by removing the existing form field and replacing it with graphical objects that would resemble the form field and cannot be edited.

    Flatten the form fields.
    Declaration
    public void FlattenFields()
    Examples
    // Load an existing document
    PdfLoadedDocument loadedDocument = new PdfLoadedDocument("../../Data/input.pdf");
    // Load an existing form
    PdfLoadedForm loadedForm = loadedDocument.Form;
    // Flatten the form fields.
    loadedForm.FlattenFields();
    //Save the PDF document
    loadedDocument.Save("output.pdf");
    //close the document
    loadedDocument.Close(true);
    'Load an existing document
    Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("../../Data/input.pdf")
    'Load an existing form
    Dim loadedForm As PdfLoadedForm = loadedDocument.Form
    'Flatten the form fields.
    loadedForm.FlattenFields()
    'Save the PDF document
    loadedDocument.Save("output.pdf")
    'close the document
    loadedDocument.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 true.

    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(Stream, ImportFormSettings)

    Imports the form data from the stream with the specified ImportFormSettings.

    Declaration
    public void ImportData(Stream stream, ImportFormSettings settings)
    Parameters
    Type Name Description
    System.IO.Stream stream
    ImportFormSettings settings
    Examples
    // Load an existing document
    PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
    // Load an existing form
    loadedForm = document.Form;
    //Create new instance for import form settings.
    ImportFormSettings settings = new ImportFormSettings();
    // Gets or sets the data format to import form fields. 
    settings.DataFormat = DataFormat.Fdf;
    //Gets or sets the value that indicates the form name of the PDF form is import.
    settings.FormName = "../../FDF_output.pdf";
    FileStream stream = new FileStream("ImportFDF.fdf", FileMode.Open);
    //Imports the form data from the stream with the specified ImportFormSettings.
    loadedForm.ImportData(stream, settings);
    //Save the PDF document
    document.Save("WF_60299_Fdf.pdf");
    //close the document
    document.Close(true);
    'Load an existing document
    Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
    'Load an existing form
    loadedForm = document.Form
    'Create new instance for import form settings.
    Dim settings As ImportFormSettings = New ImportFormSettings()
    'Gets or sets the data format to import form fields. 
    settings.DataFormat = DataFormat.Fdf
    'Gets or sets the value that indicates the form name of the PDF form is import.
    settings.FormName = "../../FDF_output.pdf"
    Dim stream As FileStream = New FileStream("ImportFDF.fdf", FileMode.Open)
    'Imports the form data from the stream with the specified ImportFormSettings. 
    loadedForm.ImportData(stream, settings)
    //Save the PDF document
    document.Save("WF_60299_Fdf.pdf")
    //close the document
    document.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 true.

    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)

    ImportData(String, ImportFormSettings)

    Imports the form data from the file with the specified ImportFormSettings.

    Declaration
    public void ImportData(string fileName, ImportFormSettings settings)
    Parameters
    Type Name Description
    System.String fileName
    ImportFormSettings settings
    Examples
    //Load an existing document
    PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
    //Load an existing form
    loadedForm = document.Form;
    //Create new instance for import form settings.
    ImportFormSettings settings = new ImportFormSettings();
    //Gets or sets the data format to import form fields. 
    settings.DataFormat = DataFormat.Fdf;
    //Gets or sets the value that indicates the form name of the PDF form is import.
    settings.FormName = "../../FDF_output.pdf";
    //Imports the form data from the file with the specified ImportFormSettings.
    loadedForm.ImportData("ImportFDF.fdf", settings);
    //Save the PDF document
    document.Save("WF_60299_Fdf.pdf");
    //close the document
    document.Close(true);
    'Load an existing document
    Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
    ' Load an existing form
    loadedForm = document.Form
    Dim settings As ImportFormSettings = New ImportFormSettings()
    'Gets or sets the data format to import form fields. 
    settings.DataFormat = DataFormat.Fdf
    'Gets or sets the value that indicates the form name of the PDF form is import.
    settings.FormName = "../../FDF_output.pdf"
    'Imports the form data from the file with the specified ImportFormSettings.
    loadedForm.ImportData("ImportFDF.fdf", settings)
    //Save the PDF document
    document.Save("WF_60299_Fdf.pdf")
    //close the document
    document.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)

    See Also

    PdfForm
    PdfLoadedDocument
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved