Fill PDF forms using XFDF in C# .NET
An XML Forms Data Format (XFDF) file stores data from forms located in PDF documents. It contains the values of the form fields and can also contain annotations.
Download sampleTo import the form data from a file, use the ImportXFDFDataFromFile method with the following required parameters:
FilePath— The file path of the XFDF file.ImportFormFields— A Boolean value that specifies whether to import the form field data.ImportAnnotations— A Boolean value that specifies whether to import the annotation data.
The example below imports form field values into a PDF form from an XFDF file:
Register the SDK license before running SDK operations. For setup details, refer to the getting started with .NET SDK guide.
using GdPicture14;
LicenseManager license = new LicenseManager();license.RegisterKEY("");using GdPicturePDF gdpicturePDF = new GdPicturePDF();gdpicturePDF.LoadFromFile(@"input_forms.pdf");gdpicturePDF.ImportXFDFDataFromFile(@"input_forms.xfdf", true, true);gdpicturePDF.SaveToFile(@"output.pdf");Register the SDK license before running SDK operations. For setup details, refer to the getting started with .NET SDK guide.
Imports GdPicture14
Dim license As LicenseManager = New LicenseManager()license.RegisterKEY("")Using gdpicturePDF As GdPicturePDF = New GdPicturePDF() gdpicturePDF.LoadFromFile("input_forms.pdf") gdpicturePDF.ImportXFDFDataFromFile("input_forms.xfdf", True, True) gdpicturePDF.SaveToFile("output.pdf")End UsingUsed methods
Related topics