> ## 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 PDFs into Factur-X / ZUGFeRD e-invoices with the facturx option on convert routes, or the dedicated PDFEngines.facturX route.

Chromium converters and `LibreOffice.convert()` accept a `facturx` option that turns the resulting PDF into a [Factur-X / ZUGFeRD](https://fnfe-mpe.org/factur-x/) e-invoice: 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 { 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",
  },
});
```

## 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"; // Distinct from the general pdfa field, which only accepts PDF/A-1b, -2b, -3b.
  pdfUA?: boolean;
};
```

## Turning existing PDFs into Factur-X

There's also a dedicated `PDFEngines.facturX()` route for turning existing PDFs into Factur-X e-invoices directly, without a conversion:

```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",
  },
});
```

See [Factur-X / ZUGFeRD (dedicated route)](/pdf-engines/factur-x) for the full reference, and [Embedding files](/advanced/embedding) for the related `embeds`/`embedsMetadata` attachment options that ZUGFeRD/Factur-X compliance also relies on.
