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

# Conformance

> Make PDFs conform to PDF/A, PDF/UA, or Factur-X, validate them, tag them, and prepare them for print.

## Remediate

`remediate` repairs a PDF until it conforms to a profile, or to a PDF/A profile and a PDF/UA one together.

| Option | Type | Description |
| - | - | - |
| `profile` | `ConformanceProfiles` | A profile, or a PDF/A–PDF/UA pair (required) |
| `language` | `string` | The document's language, as a BCP 47 tag such as `"de-DE"` (default `"en"`) |
| `aggressive` | `boolean` | Allows fixes that may change how pages look, for better compliance (default `false`) |
| `figureAltText` | `string` | The alternate text for figures that lack one |
| `xml`, `level`, `documentType` | | Factur-X only: see [below](#factur-x) |

### PDF/A

`profile` takes `"PDF/A-1a"`, `"PDF/A-1b"`, `"PDF/A-2a"`, `"PDF/A-2b"`, `"PDF/A-2u"`, `"PDF/A-3a"`, `"PDF/A-3b"`, `"PDF/A-3u"`, `"PDF/A-4"`, `"PDF/A-4e"` or `"PDF/A-4f"`. The letter sets how much the PDF keeps: `b` its look, `u` its text as Unicode too, `a` its structure too. Pick the level your archive or portal asks for.

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

const archived = await PDF.remediate({ files: ["path/to/report.pdf"], profile: "PDF/A-2b" });
```

`PDF/A-4f` needs an embedded file: [attach](https://docs.chromiumly.dev/pdf/attachments.md) one first.

### PDF/UA

`"PDF/UA-1"` and `"PDF/UA-2"` make the PDF accessible, and tag it if it isn't. Set `language`, and describe figures in your HTML's `alt` text, or with `figureAltText`.

### PDF/A and PDF/UA together

Pass a pair: PDF/A-1 to PDF/A-3 (and Factur-X) pair with `"PDF/UA-1"`, PDF/A-4 with `"PDF/UA-2"`. TypeScript only accepts these pairs.

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

const buffer = await new HtmlConverter().convert({
  html: "path/to/index.html",
  stages: [{ op: "remediate", profile: ["PDF/A-2b", "PDF/UA-1"], language: "en-US" }],
});
```

### Factur-X

`profile: "Factur-X"` makes the PDF a PDF/A-3 e-invoice, the format Germany also publishes as ZUGFeRD.

| Option | Description |
| - | - |
| `xml` | The Cross Industry Invoice (CII) XML to embed, as a [`StageFile`](https://docs.chromiumly.dev/stages#files-a-stage-needs). Without it, the stage repairs an invoice the PDF already carries |
| `level` | Required with `xml`: `"MINIMUM"`, `"BASIC WL"`, `"BASIC"`, `"EN 16931"`, `"EXTENDED"` or `"XRECHNUNG"`. It must match the level the XML declares |
| `documentType` | With `xml`: the document type written in the metadata (default `"INVOICE"`) |

```typescript theme={null}
const invoice = await PDF.remediate({
  files: ["path/to/invoice.pdf"],
  profile: "Factur-X",
  xml: "path/to/factur-x.xml",
  level: "EN 16931",
});
```

On a conversion:

```typescript theme={null}
const invoice = await new HtmlConverter().convert({
  html: "path/to/invoice.html",
  stages: [
    {
      op: "remediate",
      profile: "Factur-X",
      xml: { file: invoiceXmlBuffer, name: "factur-x.xml" },
      level: "EN 16931",
    },
  ],
});
```

### Check the result

Gotenberg answers `200` even when violations remain. It counts them in a `Gotenberg-Remediation-Residual` response header, which Chromiumly doesn't return: call [`PDF.validate()`](#validate) on the result to confirm it conforms.

### Remediate last

A list takes one `remediate`, so a pair goes in one stage. It comes after the stages that change the content: only `encrypt`, `optimize`, `sign`, `timestamp`, `render` and the extracts may follow it. A PDF/A or Factur-X can't be encrypted.

LibreOffice can also export PDF/A and PDF/UA directly with `nativePdfa` and `nativePdfua` — see [LibreOffice](https://docs.chromiumly.dev/libreoffice.md). Chromium can't: use `remediate`.

## Validate

`PDF.validate()` checks PDFs against a profile, or a PDF/A–PDF/UA pair, and lists the violations.

```typescript theme={null}
const result = await PDF.validate({
  files: ["path/to/archive.pdf"],
  profile: ["PDF/A-2b", "PDF/UA-1"],
});
// {
//   "archive.pdf": {
//     profile: ["PDF/A-2b", "PDF/UA-1"],
//     compliant: false,
//     violations: [
//       { specification: "ISO_19005_2", clause: "6.1.7.1", testNumber: 2,
//         description: "…", context: "…", severity: "fatal" }
//     ]
//   }
// }
```

A `fatal` violation makes the PDF non-compliant. A `warning`, which only the Factur-X Schematron rules raise, doesn't.

## Autotag

`autotag` infers a structure tree for an untagged PDF, so screen readers can follow it. PDF/UA requires one; `remediate` with a PDF/UA profile tags an untagged PDF on its own.

```typescript theme={null}
const tagged = await PDF.autotag({ files: ["path/to/scan.pdf"] });
```

## Prepare for print

* `convert-colors` converts every color to one color space: `target` takes `"cmyk"`, `"rgb"`, `"gray"`, or `"output-intent"` for the document's own output intent.
* `flatten-transparency` replaces transparent content with opaque content, for printers and archival formats that don't support transparency.

```typescript theme={null}
const printReady = await PDF.pipe({
  files: ["path/to/brochure.pdf"],
  stages: [{ op: "flatten-transparency" }, { op: "convert-colors", target: "cmyk" }],
});
```

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.