---
title: "Extract metadata from PDF on Android | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/android/extraction/metadata/"
md_url: "https://www.nutrient.io/guides/android/extraction/metadata.md"
last_updated: "2026-05-25T12:14:42.812Z"
description: "Nutrient comes with DocumentPdfMetadata and DocumentXmpMetadata, which allow you to retrieve or modify a document’s metadata."
---

# Extract metadata from PDFs on Android

Nutrient comes with [`DocumentPdfMetadata`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.metadata/-document-pdf-metadata/index.html) and [`DocumentXmpMetadata`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.metadata/-document-xmp-metadata/index.html), which allow you to retrieve or modify a document’s metadata. This guide covers extracting metadata (to modify metadata, see our separate guide for [editing metadata](https://www.nutrient.io/guides/android/customizing-pdf-pages/customizing-document-metadata.md)).

## Dictionary-based metadata

Use [`DocumentPdfMetadata`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.metadata/-document-pdf-metadata/index.html) to work with the dictionary-based metadata in a PDF.

All values specified in the [`PdfValue`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document/-pdf-value/index.html) are represented by the following types:

- `Boolean`

- `long`

- `double`

- `String`

- `List<PdfValue>`

- `Map<String, PdfValue>`

By default, the dictionary metadata may contain the following information keys:

- `Author`

- `CreationDate`

- `Creator`

- `Keywords`

- `ModDate`

- `Producer`

- `Title`

You can, of course, add any supported key-value dictionary to the metadata. When dealing with these predefined keys, it’s recommended to use the [`DocumentPdfMetadata`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.metadata/-document-pdf-metadata/index.html) getters and setters so that you get out-of-the-box conversions from objects such as `Date`.




To get an entry of the metadata dictionary (e.g. the `Author`), you can use the following code snippet:

### KOTLIN

```kotlin

val document =...
val pdfMetadata = document.getPdfMetadata()
val author = pdfMetada.getAuthor()

```

### JAVA

```java

PdfDocument document =...
DocumentPdfMetadata pdfMetadata = document.getPdfMetadata();
String author = pdfMetadata.getAuthor();

```

For any custom values, use this:

### KOTLIN

```kotlin

val document =...
val pdfMetadata = document.pdfMetadata
val value = pdfMetada.get("Custom key")

```

### JAVA

```java

PdfDocument document =...
DocumentPdfMetadata pdfMetadata = document.getPdfMetadata();
PdfValue value = pdfMetadata.get("Custom key");

```

## XMP metadata

Use [`DocumentXmpMetadata`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.metadata/-document-xmp-metadata/index.html) to work with the metadata stream containing XMP data.

Each key in the XMP metadata stream has to have a namespace set. You can define your own namespace or use one of the already existing ones. PSPDFKit exposes two constants for common
namespaces:

- `DocumentPdfMetadata#XMP_PDF_NAMESPACE`/`DocumentPdfMetadata#XMP_PDF_NAMESPACE_PREFIX`

  — [the XMP PDF namespace created by Adobe](https://developer.adobe.com/xmp/docs/XMPSpecifications/) §3.1

- `DocumentXmpMetadata#XMP_DC_NAMESPACE`/`DocumentXmpMetadata#XMP_DC_NAMESPACE_PREFIX`

  — [the Dublin Core namespace](https://en.wikipedia.org/wiki/Dublin_Core)

When setting a value, you also have to pass along a suggested namespace prefix, as this can’t be generated automatically.





Use the following code snippet to get an object from the XMP metadata:

### KOTLIN

```kotlin

val xmpMetadata = document.xmpMetadata
val pdfValue = xmpMetadata.get("Key", NAMESPACE)

```

### JAVA

```java

DocumentXmpMetadata xmpMetadata = document.getXmpMetadata();
PdfValue pdfValue = xmpMetadata.get("Key", NAMESPACE);

```
---

## Related pages

- [Effortlessly parse PDF content on Android](/guides/android/extraction/parse-content.md)
- [Extract pages from PDFs on Android](/guides/android/extraction/page-extraction.md)
- [Easily extract text from PDFs on Android](/guides/android/features/text-extraction.md)
- [PDF extraction library for Android](/guides/android/extraction.md)
- [Extract selected text from PDFs on Android](/guides/android/extraction/selected-text.md)
- [Extract the text position from PDFs on Android](/guides/android/extraction/text-position.md)

