Skip to main content
Version: 9.x

Rotate pages

Sets the rotation of pages: a quarter, a half or three quarters of a turn.

POST/forms/pdf/rotate
filesfile[]required

The PDFs.

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.

angleintegerrequired

A multiple of 90, such as 90 or -90.

The pages to rotate.

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.

curl \
--request POST http://localhost:3000/forms/pdf/rotate \
--form files=@report.pdf \
--form angle=90 \
--form pages=1 \
-o report.pdf

Viewers turn the page by the angle, clockwise. -90 turns it the other way. The angle replaces the rotation the page has, so 90 on a page already at 90 changes nothing, and 0 straightens it. Without pages, every page takes the angle.

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 'stages=[
{ "op": "rotate", "angle": 90, "pages": "1" }
]' \
-o report.pdf