Fix sideways scans: rotate PDF pages with an API

Scanners and phone apps save pages on their side. How to rotate all pages, or only the wrong ones, with one API call, and why the rotation does not touch quality.

A scanned page lying on its side is turned upright

Sideways pages are the most common complaint about scanned PDFs. A phone scanning app guesses the orientation wrong, or a sheet goes into the feeder the wrong way, and page 4 of 20 arrives on its side. The PDF Rotate API fixes it with one call.

Rotate every page, or only some

Send the angle and, optionally, the pages to turn:

curl https://api.justapi.tech/v1/pdf/rotate \
  -H "Authorization: Bearer ak_live_..." \
  -H "Content-Type: application/json" \
  -d '{"source": {"url": "https://files.example.com/scan.pdf"}, "options": {"angle": 90, "pages": "4,7-8"}}'
  • angle is 90, 180 or 270 degrees, clockwise. Use a negative value, or 270, to turn counter-clockwise.
  • pages takes the same lists as every page tool: 4, 7-8, odd, even, -1 for the last page. Leave it out to turn every page.

The rotation adds to what is already there. A page already stored at 90 degrees and turned by 90 more ends up at 180.

Which pages are wrong?

The API does not guess orientation: it turns exactly the pages you list. If your workflow does not know which pages are sideways, there are two common patterns. Let a person mark them in your app and send their numbers. Or render the first page with the PDF to Image API, check it, and decide. Guessing from content with an AI model is out of scope here; this API is deterministic and gives the same output for the same input.

The content is not touched

A PDF page has a rotation value. Rotate changes that value and nothing else, so text, images and fonts stay byte for byte the same, and the file size barely moves. More on that in why rotating a PDF should not change its size.

Failures and cost

A digitally signed PDF is refused with signed_pdf, because changing it would break the signature. An encrypted PDF is refused with encrypted_pdf. A page number past the end is an invalid_request. None of these are charged.

A successful call costs $0.005 at the first volume tier, whatever the file size.

Try it

The free PDF rotator does the same job on one file up to 5 MB, five times a day. The full reference is in the PDF Rotate API docs.