> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chromiumly.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Metadata and bookmarks

> Write and read a PDF's document information and bookmarks.

## Write the metadata

`set-metadata` writes the eight standard document information fields. A field you leave out keeps its value.

| Option | Description |
| - | - |
| `title`, `author`, `subject`, `keywords` | What a viewer shows |
| `creator` | The application that made the original document |
| `producer` | The application that made the PDF |
| `creationDate`, `modDate` | PDF dates, such as `"D:20260101120000Z"` |

```typescript theme={null}
import { PDF } from "chromiumly";

const titled = await PDF.setMetadata({
  files: ["path/to/report.pdf"],
  title: "Quarterly report",
  author: "Finance",
  creationDate: "D:20260101120000Z",
});
```

As a stage on a conversion:

```typescript theme={null}
import { UrlConverter } from "chromiumly";

const buffer = await new UrlConverter().convert({
  url: "https://example.com/",
  stages: [{ op: "set-metadata", title: "Example", author: "Web team" }],
});
```

Chromium takes the title from the page's `<title>`, and LibreOffice from the document's properties; `set-metadata` overrides them.

## Read the metadata

`PDF.metadata()` answers the same eight fields, each when set, under each PDF's name. A PDF without metadata answers `{}`.

```typescript theme={null}
const metadata = await PDF.metadata({ files: ["path/to/report.pdf"] });
// { "report.pdf": { title: "Quarterly report", author: "Finance" } }
```

A date comes back as the PDF stores it: a PDF date (`D:20260101120000Z`), which `set-metadata` takes, or an XMP date (`2026-01-01T12:00:00Z`) when only the XMP metadata holds it.

## Bookmarks

`set-bookmarks` replaces the bookmarks, the outline viewers show beside the pages. Each bookmark takes a `title`, a `pageNumber`, and optional `children`.

```typescript theme={null}
const outlined = await PDF.setBookmarks({
  files: ["path/to/report.pdf"],
  bookmarks: [
    { title: "Summary", pageNumber: 1, children: [{ title: "Figures", pageNumber: 2 }] },
    { title: "Appendix", pageNumber: 3 },
  ],
});
```

`PDF.bookmarks()` reads them back in the same shape:

```typescript theme={null}
const bookmarks = await PDF.bookmarks({ files: ["path/to/report.pdf"] });
// { "report.pdf": [{ title: "Summary", pageNumber: 1, children: [...] }, ...] }
```

To build bookmarks while converting instead, set `nativeBookmarks: true` on a [Chromium](https://docs.chromiumly.dev/chromium/options.md) conversion (from the headings), or keep LibreOffice's default `nativeBookmarks`.

See [Reference — PDF](https://docs.chromiumly.dev/reference/pdf.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.