---
title: "Import XFDF annotation data to PDF in C# .NET | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/annotations/import-xfdf/"
md_url: "https://www.nutrient.io/guides/dotnet/annotations/import-xfdf.md"
last_updated: "2026-06-18T07:25:36.492Z"
description: "Learn how to import XMP and XFDF annotations in your .NET applications with our comprehensive guide."
---

# Import XFDF annotation data to PDFs in C# .NET

### XMP

[XMP](https://www.nutrient.io/guides/dotnet/annotations/import-xmp.md)

### XFDF

[XFDF](https://www.nutrient.io/guides/dotnet/annotations/import-xfdf.md)

An XML Forms Data Format (XFDF) file stores data from annotations located in PDF documents. It contains the annotation structure and the values submitted to it.

## Importing XFXF data from a file

To import the annotation data from a file, use the [`ImportXFDFDataFromFile` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ImportXFDFDataFromFile.html) 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 a PDF annotation from an XFDF file:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
gdpicturePDF.ImportXFDFDataFromFile(@"C:\temp\annotation.xfdf", true, true);
gdpicturePDF.SaveToFile(@"C:\temp\output.pdf");

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    gdpicturePDF.ImportXFDFDataFromFile("C:\temp\annotation.xfdf", True, True)
    gdpicturePDF.SaveToFile("C:\temp\output.pdf")
End Using

```

#### Used methods

- [`ImportXFDFDataFromFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ImportXFDFDataFromFile.html)

- [`LoadFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~LoadFromFile.html)

- [`SaveToFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SaveToFile.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)



## Importing XFXF data from a database

To import the annotation data from a database, save the XFDF information from the database as a `Stream` object, and then use the [`ImportXFDFDataFromStream` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ImportXFDFDataFromStream.html) 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 a PDF annotation from a `Stream` object containing XFDF information:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
gdpicturePDF.ImportXFDFDataFromStream(XFDFStream, true, true);
gdpicturePDF.SaveToFile(@"C:\temp\output.pdf");

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    gdpicturePDF.ImportXFDFDataFromStream(XFDFStream, True, True)
    gdpicturePDF.SaveToFile("C:\temp\output.pdf")
End Using

```

#### Used methods

- [`ImportXFDFDataFromStream`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ImportXFDFDataFromStream.html)

- [`LoadFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~LoadFromFile.html)

- [`SaveToFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SaveToFile.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)
---

## Related pages

- [Annotate on images in C# .NET](/guides/dotnet/annotations/annotate-on-images.md)
- [Attach a file to an annotation in C#](/guides/dotnet/annotations/attach-a-file.md)
- [Custom annotations](/guides/dotnet/annotations/custom-annotations.md)
- [Edit PDF annotations in C#](/guides/dotnet/annotations/edit.md)
- [Attach an image to an annotation in C#](/guides/dotnet/annotations/attach-an-image.md)
- [Create an annotation in a PDF using C#](/guides/dotnet/annotations/create.md)
- [Export annotation data from PDFs in C# .NET](/guides/dotnet/annotations/export-pdf.md)
- [Export XMP annotation data in C# .NET](/guides/dotnet/annotations/export-xmp.md)
- [Flatten PDF annotations in C# .NET](/guides/dotnet/annotations/flatten.md)
- [Get PDF annotation properties in C# .NET](/guides/dotnet/annotations/get-properties.md)
- [Import XMP annotation data to PDF or image in C#](/guides/dotnet/annotations/import-xmp.md)
- [PDF annotations in C#.NET](/guides/dotnet/annotations.md)
- [Stamp a PDF document in C# .NET](/guides/dotnet/annotations/stamp-a-document.md)
- [Remove PDF annotations in C# .NET](/guides/dotnet/annotations/remove.md)
- [Add PDF actions using C# in form fields](/guides/dotnet/annotations/pdf-actions-support.md)
- [XMP annotations in C# .NET](/guides/dotnet/annotations/xmp-annotations.md)

