Pagecraft

rotate

Rotate PDF

Turn chosen pages a quarter, half or three-quarter turn.

Reads
a PDF — application/pdf
Writes
one file — PDFs
Tool page
/rotate-pdf

Example

Stand a landscape scan upright.

Given

  • scan.pdf — an ordinary PDF of 3 pages

From code

            import { loadDocument, runOperation } from '@pagecraft/core';

const scan = await loadDocument({ bytes, name: 'scan.pdf' });

const [output] = await runOperation('rotate', [scan], {
  pages: 'all',
  angle: '90',
});
          

From a shell

            pagecraft rotate scan.pdf --pages all --angle 90
          

What comes back

One PDF of 3 pages.

This example is run by the test suite. If it stopped being true, the build would fail.

Options

pages--pages

string, a page selection: '1-3, 7, 9-', 'even', 'last'

Pages

Which pages to turn. The rest are left exactly as they are.

Default: 'all'

angle--angle

string, one of

Turn

Default: '90'

  • 90 — Right, a quarter turn clockwise
  • 180 — Upside down
  • 270 — Left, a quarter turn anticlockwise