This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/forms/fill-form-fields/import-from-database.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Fill PDF forms from database in C# | Nutrient .NET SDK

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 sample

To import the form data from a database, save the XFDF information from the database as a Stream object, and then use the ImportXFDFDataFromStream method with the following required parameters:

  • Stream — The Stream object containing XFDF information.
  • 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 a Stream object containing XFDF information:

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();
byte[] xfdfData = File.ReadAllBytes(@"input_forms.xfdf");
using MemoryStream xfdfStream = new MemoryStream(xfdfData);
gdpicturePDF.LoadFromFile(@"input_forms.pdf");
gdpicturePDF.ImportXFDFDataFromStream(xfdfStream, true, true);
gdpicturePDF.SaveToFile(@"output.pdf");