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

# Types

> PageProperties, ConversionOptions, ImageProperties, PdfFormat, Split, and other shared types.

## PdfFormat

```typescript theme={null}
enum PdfFormat {
  /** @deprecated LibreOffice no longer supports PDF/A-1a since Gotenberg 7.6; kept for backward compatibility. */
  A_1a = "PDF/A-1a",
  A_1b = "PDF/A-1b",
  A_2b = "PDF/A-2b",
  A_3b = "PDF/A-3b",
}
```

## PathLikeOrReadStream

`string` (file path), `Buffer`, or `ReadStream` (from `fs`).

## PageProperties (converters)

Every field of `size` and `margins` defaults independently — set just one dimension or margin and let Gotenberg fill in the rest.

| Property | Type | Default / notes |
| - | - | - |
| singlePage | boolean | false |
| size | `{ width?, height? }` (number or string) | width/height in inches (number) or units: pt, px, in, mm, cm, pc |
| margins | object (top?, bottom?, left?, right?) | same units as size |
| preferCssPageSize | boolean | false |
| printBackground | boolean | false |
| omitBackground | boolean | false |
| landscape | boolean | false |
| scale | number | 1.0 |
| nativePageRanges | `{ from, to }` \| string | free-form syntax also supported, e.g. `"1-5, 8, 11-13"` |

## ImageProperties (screenshots)

| Property | Type | Notes |
| - | - | - |
| format | `'png'` / `'jpeg'` / `'webp'` | required |
| quality | number | 0–100, JPEG only |
| omitBackground | boolean | — |
| width | number | default 800 |
| height | number | default 600 |
| clip | boolean | default false |
| deviceScaleFactor | number | default 1, useful for HiDPI screenshots |

## Split / ConvertSplit

`Split` is used by the dedicated `PDFEngines.split()` route, where `flatten` is part of the split configuration itself:

```typescript theme={null}
type Split = {
  mode: "pages" | "intervals";
  span: string; // e.g. "1-2", "1,3,5"
  unify?: boolean; // only for mode 'pages'
  flatten?: boolean;
};
```

`ConvertSplit` (`Omit<Split, 'flatten'>`) is used by the `split` option on Chromium converters and `LibreOffice.convert()`, where `flatten` is instead a separate top-level option — see [Split PDFs](https://docs.chromiumly.dev/v6/pdf-engines/split.md).

## Metadata

```typescript theme={null}
type Metadata = { [key: string]: boolean | number | string | string[] };
```

Use standard PDF/XMP keys (e.g. Author, Title, Keywords). See [ExifTool PDF/XMP](https://exiftool.org/TagNames/XMP.html#pdf).

## DownloadFrom

```typescript theme={null}
type DownloadFromEntry = {
  url: string;
  extraHttpHeaders?: Record<string, string>;
  embedded?: boolean;
  field?: "embedded" | "watermark" | "stamp" | "";
};

type DownloadFrom = DownloadFromEntry | DownloadFromEntry[];
```

Use `downloadFrom` when Gotenberg should fetch files from remote URLs that return a `Content-Disposition` filename.

## WebhookOptions

```typescript theme={null}
type WebhookOptions = {
  webhookUrl?: string; // At least one of webhookUrl or webhookErrorUrl is required.
  /** @deprecated Use webhookEventsUrl instead, together with webhookUrl. */
  webhookErrorUrl?: string;
  webhookMethod?: "POST" | "PUT" | "PATCH";
  webhookErrorMethod?: "POST" | "PUT" | "PATCH";
  webhookExtraHttpHeaders?: Record<string, string>;
  webhookEventsUrl?: string;
};
```

Use `webhook` to switch a request to async callback mode. See [Request tracing](https://docs.chromiumly.dev/v6/advanced/request-tracing.md).

## OutputOptions

```typescript theme={null}
type OutputOptions = {
  outputFilename?: string; // Custom filename for the resulting file; Gotenberg appends the extension.
  trace?: string; // Custom request id to identify the request in the logs, overriding the generated UUID.
};
```

Accepted by every route, including [System](https://docs.chromiumly.dev/v6/reference/system.md) (`trace` only, since there's no resulting file). See [Request tracing](https://docs.chromiumly.dev/v6/advanced/request-tracing.md).

## PdfEnginePermissions

```typescript theme={null}
type PdfEnginePermissions = {
  allowPrinting?: boolean; // default true
  allowCopying?: boolean; // default true
  allowModifying?: boolean; // default true
  allowAnnotating?: boolean; // default true
  allowFillingForms?: boolean; // default true
  allowAssembling?: boolean; // default true
};
```

Accepted wherever `userPassword`/`ownerPassword` are. See [PDF permissions](https://docs.chromiumly.dev/v6/advanced/permissions.md).

## EmbedsMetadata

```typescript theme={null}
type EmbedsMetadata = Record<
  string, // filename, matching an entry in `embeds`
  {
    mimeType?: string; // Written to the embedded file stream's /Subtype
    relationship?:
      | "Source"
      | "Data"
      | "Alternative"
      | "Supplement"
      | "Unspecified"; // The /AFRelationship value
  }
>;
```

Per-attachment metadata, for PDF/A-3 and Factur-X compliance. See [Embedding files](https://docs.chromiumly.dev/v6/advanced/embedding.md).

## FacturXOptions

```typescript theme={null}
type FacturXOptions = {
  facturxXml: PathLikeOrReadStream; // 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"; // default 'INVOICE'
  facturxVersion?: string; // default '1.0'
  pdfa?: "PDF/A-3a" | "PDF/A-3b" | "PDF/A-3u";
  pdfUA?: boolean;
};
```

See [Factur-X / ZUGFeRD](https://docs.chromiumly.dev/v6/advanced/factur-x.md).

## Cookie

```typescript theme={null}
type Cookie = {
  name: string;
  value: string;
  domain: string;
  path?: string;
  secure?: boolean;
  httpOnly?: boolean;
  sameSite?: "Strict" | "Lax" | "None";
};
```

## EmulatedMediaType / EmulatedMediaFeature

* `EmulatedMediaType`: `'screen'` or `'print'`
* `EmulatedMediaFeature`: object with `name` and `value` strings (e.g. `prefers-color-scheme`, `prefers-reduced-motion`)

Conversion options include the shared Chromium options (`userAgent`, header, footer, wait\*, extraHttpHeaders, failOn\*, `skipNetworkIdleEvent`, `skipNetworkAlmostIdleEvent`, `generateDocumentOutline`, cookies, downloadFrom, webhook, etc.) plus `properties`, `pdfUA`, `generateTaggedPdf`, `metadata`, `split`, `flatten`, `userPassword`, `ownerPassword`, the six [permission](https://docs.chromiumly.dev/v6/advanced/permissions.md) booleans, `embeds`, `embedsMetadata`, `facturx`, `watermark`/`stamp`/`rotate`, and `outputFilename`/`trace`. See [Converters](https://docs.chromiumly.dev/v6/reference/converters.md) and [Chromium options](https://docs.chromiumly.dev/v6/chromium/options.md) for the full list.

## PdfEngineRotate

Used by converter `convert()`, `LibreOffice.convert()`, `PDFEngines.merge()`, and `PDFEngines.split()` as optional post-processing. Angles match Gotenberg: `90`, `180`, or `270` degrees.

```typescript theme={null}
type PdfEngineRotate = {
  angle: 90 | 180 | 270;
  pages?: string; // e.g. "1-3", "5"; omit for all pages
};
```

## PdfEngineWatermark / PdfEngineStamp

Used by converter `convert()`, `LibreOffice.convert()`, `PDFEngines.merge()`, `PDFEngines.split()`, and dedicated `PDFEngines.watermark()` / `PDFEngines.stamp()`.

```typescript theme={null}
type PdfEngineWatermark = {
  source?: "text" | "image" | "pdf";
  expression?: string;
  pages?: string;
  options?: Record<string, unknown>;
  file?: PathLikeOrReadStream | Buffer;
};

type PdfEngineStamp = {
  source?: "text" | "image" | "pdf";
  expression?: string;
  pages?: string;
  options?: Record<string, unknown>;
  file?: PathLikeOrReadStream | Buffer;
};
```

For `image`/`pdf` sources, set `expression` to the uploaded filename and pass the asset in `file`.

## Bookmark

```typescript theme={null}
type Bookmark = {
  title: string;
  page: number;
  children?: Bookmark[];
};
```

## Template types (hosted API)

The hosted `Templates` class exports these types:

```typescript theme={null}
type TemplateType =
  | "invoice_freelancer"
  | "invoice_saas"
  | "invoice_classic"
  | "invoice_minimal"
  | "invoice_modern";

type TemplateRequest<TType extends TemplateType> = {
  type: TType;
  data: TemplateDataByType[TType];
};
```

`Templates.generate(request, { validate?: boolean })` uses `TemplateRequest<TType>` and returns `Promise<Buffer>`.


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