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

# Factur-X / ZUGFeRD

> Turn existing PDFs into Factur-X / ZUGFeRD e-invoices with PDFEngines.facturX, or via the facturx option on convert routes.

## PDFEngines.facturX

Turns existing PDFs into [Factur-X / ZUGFeRD](https://fnfe-mpe.org/factur-x/) e-invoices directly using Gotenberg's [Factur-X route](https://gotenberg.dev/docs/manipulate-pdfs/factur-x), without going through a conversion: it embeds the CII invoice XML under the canonical `factur-x.xml` name and converts the PDF to PDF/A-3.

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

const invoice = await PDFEngines.facturX({
  files: ["path/to/document.pdf"],
  facturx: {
    facturxXml: "path/to/invoice.xml",
    facturxConformanceLevel: "EN 16931",
    facturxDocumentType: "INVOICE", // optional, defaults to 'INVOICE'
    facturxVersion: "1.0", // optional, defaults to '1.0'
  },
});
```

## facturx payload shape

```typescript theme={null}
type FacturXOptions = {
  facturxXml: PathLikeOrReadStream; // The Factur-X CII invoice XML; embedded as factur-x.xml regardless of the given filename.
  facturxConformanceLevel:
    | "MINIMUM"
    | "BASIC WL"
    | "BASIC"
    | "EN 16931"
    | "EXTENDED"
    | "XRECHNUNG";
  facturxDocumentType?: "INVOICE" | "ORDER" | "ORDER_RESPONSE" | "ORDER_CHANGE"; // Defaults to 'INVOICE'.
  facturxVersion?: string; // Defaults to '1.0'.
  pdfa?: "PDF/A-3a" | "PDF/A-3b" | "PDF/A-3u";
  pdfUA?: boolean;
};
```

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

## Factur-X on convert routes

Chromium converters and `LibreOffice.convert()` also accept a `facturx` option directly, so you can generate a Factur-X-compliant PDF in the same request that renders it:

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

const htmlConverter = new HtmlConverter();
const buffer = await htmlConverter.convert({
  html: "path/to/index.html",
  facturx: {
    facturxXml: "path/to/invoice.xml",
    facturxConformanceLevel: "EN 16931",
  },
});
```

See [Factur-X](/advanced/factur-x) for the full cross-cutting reference.
