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

# Split PDFs

> Split PDFs by page ranges or intervals with PDFEngines.split or the split option on Chromium/LibreOffice.

## PDFEngines.split

Splits PDFs using Gotenberg’s [split route](https://gotenberg.dev/docs/manipulate-pdfs/split-pdfs):

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

const buffer = await PDFEngines.split({
  files: ["path/to/file_1.pdf", "path/to/file_2.pdf"],
  options: {
    mode: "pages",
    span: "1-2",
    unify: true,
  },
});
```

* **mode** — `"pages"` or `"intervals"`
* **span** — Page range string (e.g. `"1-2"`, `"1,3,5"`)
* **unify** — When `mode` is `"pages"`, merge the split results into one PDF
* **flatten** — Flatten form fields and annotations in the output

<Warning>
  Gotenberg does not validate `span` when `mode` is `"pages"`; validation
  depends on the engine. See [Gotenberg PDF Engines
  configuration](https://gotenberg.dev/docs/configuration#pdf-engines).
</Warning>

`PDFEngines.split()` also accepts optional `watermark`, `stamp`, and `rotate` for PDF-engine post-processing on the split output. See [Rotate PDFs](/pdf-engines/rotate).

## Split on Chromium and LibreOffice

Chromium converters and LibreOffice also support a `split` option on `convert()` so you can split the generated PDF in the same request:

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

const buffer = await new UrlConverter().convert({
  url: "https://example.com/",
  split: { mode: "pages", span: "1-2", unify: true },
});
```

See [Chromium options](/chromium/options) and [Reference — types](/reference/types) for the `Split` type.
