> ## 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.

# Embed files in PDFs

> Attach files to existing PDFs with PDFEngines.embed, or via embeds/embedsMetadata on convert routes.

## PDFEngines.embed

Attaches files to existing PDFs directly using Gotenberg's [embed route](https://gotenberg.dev/docs/manipulate-pdfs/attachments), without going through a conversion:

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

const embedded = await PDFEngines.embed({
  files: ["path/to/document.pdf"],
  embeds: ["path/to/invoice.xml", "path/to/logo.png"],
  embedsMetadata: {
    "invoice.xml": { mimeType: "text/xml", relationship: "Data" },
  },
});
```

* **files** — PDFs to embed into.
* **embeds** — Files to attach inside the PDF.
* **embedsMetadata** — Per-attachment metadata keyed by filename, for PDF/A-3 and Factur-X compliance.

`downloadFrom`, `webhook`, `outputFilename`, and `trace` are also accepted — see [Request tracing](/advanced/request-tracing).

## Embedding on convert routes

Chromium converters and `LibreOffice.convert()` also accept `embeds` and `embedsMetadata` directly, so you can attach files in the same request that generates the PDF. See [Embedding files](/advanced/embedding) for the full cross-cutting reference and the `embedsMetadata` shape.
