---
title: "Read & edit PDF XMP metadata using C# | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/editor/metadata-xmp/"
md_url: "https://www.nutrient.io/guides/dotnet/editor/metadata-xmp.md"
last_updated: "2026-06-09T10:26:34.524Z"
description: "Learn to read and edit EXIF, XMP, and IPTC metadata in PDFs using C#. Explore comprehensive guides for effective metadata management."
---

# Read and edit PDF XMP metadata using C#

### EXIF Tags

[EXIF Tags](https://www.nutrient.io/guides/dotnet/editor/metadata-exif.md)

### Page Labels

[Page Labels](https://www.nutrient.io/guides/dotnet/editor/metadata-pdf-page-label.md)

### XMP

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

### IPTC

[IPTC](https://www.nutrient.io/guides/dotnet/editor/metadata-iptc.md)

XMP (Extensible Metadata Platform) is an ISO standard used for creating and processing standardized and custom metadata for digital documents. It uses the RDF/XML syntax, which is embedded into a file. It consists of name/value pairs and allows using structured values and lists of values, as well as nesting them in other values.

## Supported image formats

- JPEG (read and write)

- PNG (read and write)

- TIFF (read and write)

- WebP (read and write)

## Getting XMP metadata from a PDF document

To get the XMP metadata of a PDF document, use the [`GetMetadata` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~GetMetadata.html). This method doesn’t require any parameters and returns a string value of the document metadata in XMP format.

To get a PDF’s XMP metadata, use the following code:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Get the XMP metadata.
string metadata = gdpicturePDF.GetMetadata();
Console.WriteLine(metadata);

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Get the XMP metadata.
    Dim metadata As String = gdpicturePDF.GetMetadata()
    Console.WriteLine(metadata)
End Using

```

#### Used methods

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

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

#### Related topics

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

## Getting XMP metadata from a PDF page

To get the XMP metadata from a PDF page, use the [`GetPageMetadata` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~GetPageMetadata().html). Before using this method in your code, use the [`SelectPage` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SelectPage.html) to specify from which page you want to get the XMP metadata.

The `GetPageMetadata` method doesn’t require any parameters and returns a string value of the document metadata in XMP format.

To get the XMP metadata of the first page of a PDF, use the following code:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Select the first page of the PDF document.
gdpicturePDF.SelectPage(1);
// Get the XMP metadata.
string metadata = gdpicturePDF.GetPageMetadata();
Console.WriteLine(metadata);

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Select the first page of the PDF document.
    gdpicturePDF.SelectPage(1)
    ' Get the XMP metadata.
    Dim metadata As String = gdpicturePDF.GetPageMetadata()
    Console.WriteLine(metadata)
End Using

```

#### Used methods

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

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

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

#### Related topics

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

## Setting XMP metadata for a PDF document

To set XMP metadata for a PDF document, use the [`SetMetadata` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SetMetadata.html). It requires XMP metadata in the form of a string as its parameter.

To set XMP metadata for a PDF document from an XMP file, use the following code:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Save the metadata to a string from a file.
String data = File.ReadAllText(@"C:\temp\metadata.xmp");
// Set the metadata from the string.
gdpicturePDF.SetMetadata(data);
gdpicturePDF.SaveToFile(@"C:\temp\source.pdf");

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Save the metadata to a string from a file.
    Dim data = File.ReadAllText("C:\temp\metadata.xmp")
    ' Set the metadata from the string.
    gdpicturePDF.SetMetadata(data)
    gdpicturePDF.SaveToFile("C:\temp\source.pdf")
End Using

```

#### Used methods

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

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

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

#### Related topics

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

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

## Setting XMP metadata for a PDF page

To set the XMP metadata for a PDF page, use the [`SetPageMetadata` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SetPageMetadata.html). Before using this method in your code, use the [`SelectPage` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SelectPage.html) to specify from which page you want to get the XMP metadata.

The `GetPageMetadata` method requires the XMP metadata as its parameter in the form of either a string or a byte array.

To set the XMP metadata of the first page of a PDF from a byte array, use the following code:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Select the first page of the PDF document.
gdpicturePDF.SelectPage(1);
// Save the metadata to a byte array from a file.
byte[] data = File.ReadAllBytes(@"C:\temp\metadata.xmp");
// Set the metadata from the byte array.
gdpicturePDF.SetPageMetadata(data);
gdpicturePDF.SaveToFile(@"C:\temp\source.pdf");

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Select the first page of the PDF document.
    gdpicturePDF.SelectPage(1)
    ' Save the metadata to a byte array from a file.
    Dim data = File.ReadAllBytes("C:\temp\metadata.xmp")
    ' Set the metadata from the byte array.
    gdpicturePDF.SetPageMetadata(data)
    gdpicturePDF.SaveToFile("C:\temp\source.pdf")
End Using

```

#### Used methods

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

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

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

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

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

#### Related topics

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

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

## Adding a custom XMP metadata entry to a PDF document

To add a custom metadata entry to a PDF document in XMP format, use the [`SetCustomPDFInformation` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SetCustomPDFInformation.html). It requires the key and the value of the custom XMP metadata in the form of a string.

To add a custom XMP metadata entry to a PDF document describing from which department the file originates, use the following code:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Add custom XMP metadata.
gdpicturePDF.SetCustomPDFInformation("Department", "Human Resources");
gdpicturePDF.SaveToFile(@"C:\temp\source.pdf");

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Add custom XMP metadata.
    gdpicturePDF.SetCustomPDFInformation("Department", "Human Resources")
    gdpicturePDF.SaveToFile("C:\temp\source.pdf")
End Using

```

#### Used methods

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

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

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

#### Related topics

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

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

## Related pages

- [Add an image to another image using C#](/guides/dotnet/editor/add-image-to-image.md)
- [Add an image to a PDF using C#](/guides/dotnet/editor/add-image-to-pdf.md)
- [Add text to an image using C#](/guides/dotnet/editor/add-text-to-image.md)
- [Add a page to a PDF or a TIFF image in C# .NET](/guides/dotnet/editor/add-page.md)
- [Attach a file to a PDF in C#](/guides/dotnet/editor/attach-a-file.md)
- [Add text to PDFs in C#](/guides/dotnet/editor/add-text-to-pdf.md)
- [Merge PDFs in C#](/guides/dotnet/editor/merge-or-combine.md)
- [PDF and image editor in C#.NET](/guides/dotnet/editor.md)
- [Modify EXIF metadata using C#](/guides/dotnet/editor/metadata-exif.md)
- [Edit IPTC metadata using C#](/guides/dotnet/editor/metadata-iptc.md)
- [Split PDF pages into multiple pages in C#](/guides/dotnet/editor/split.md)
- [Read and edit PDF page label metadata using C#](/guides/dotnet/editor/metadata-pdf-page-label.md)
- [Add watermarks to PDFs and images in C#](/guides/dotnet/editor/watermark.md)

