Skip to main content
Version: 9.x

Insert pages

Inserts the pages of another PDF.

POST/forms/pdf/insert
filesfile[]required

The PDFs, and the files the options name.

archivesfile[]

ZIP files Gotenberg unpacks: each entry counts as a file uploaded under files.

URLs Gotenberg downloads first, as if you had uploaded the files. Each entry takes a url, and optionally extraHttpHeaders.

sourcefilerequired

The uploaded PDF whose pages to insert.

atinteger

Inserts after this page. 0 inserts before the first page.

Default: 0

The pages of source to insert.

Default: all

The PDF, or a ZIP of the PDFs when you send several.

The route also takes the headers. An error answers a status and a message: see Errors.

Insert the pages of another PDF after a given page:

curl \
--request POST http://localhost:3000/forms/pdf/insert \
--form files=@report.pdf \
--form files=@annex.pdf \
--form source=annex.pdf \
--form at=1 \
-o report.pdf

at: 0 inserts before the first page, and sourcePages picks the pages of annex.pdf to insert. The stage reads annex.pdf, so Gotenberg doesn't process it as a PDF of its own.

In a list of stages​

The stage also runs in a list on /forms/pdf/pipe, and on the PDFs a Chromium or LibreOffice conversion makes, in its stages field:

curl \
--request POST http://localhost:3000/forms/pdf/pipe \
--form files=@report.pdf \
--form files=@annex.pdf \
--form 'stages=[
{ "op": "insert", "source": "annex.pdf", "at": 1 }
]' \
-o report.pdf