Skip to content
Fix "sideways PDF" in one request — rotate specific pages or the whole file

Rotate PDF API

Still shipping PDFs where page 3 is sideways, page 7 is upside down, and the "fix" is a manual re-export? Rotate by 90, 180, or 270 degrees — and choose exact pages so you don't accidentally break a perfectly fine layout.

50,000+ teams ship cleaner PDFs
Typical integration: < 15 minutes
Rotate pages (only what's broken)
cURL
curl -X POST "https://api.xspdf.com/v1/pdf/rotate" \
  -H "Authorization: Bearer $API_KEY" \
  -F "file=@report.pdf" \
  -F "rotation=90" \
  -F "pages=3,7-9" \
  -o "report.fixed.pdf"

Rotation accepts: 90, 180, 270. Pages accepts: all, a list (3,7,9), or ranges (7-9).

Avg. fix time
6.4s
per document (API-side)
Layout mistakes prevented
1.8M+
rotations/month
99.95%
successful processing rate (rolling 30 days)
47 min/day
time saved vs manual "rotate & re-export"
120M+
PDF pages normalized (rotated/cleaned)
3 steps
upload → rotate → download (or stream)

You know the feeling when the PDF is "almost right"…

Page 1 looks perfect. Page 2 is fine. Then suddenly page 3 is rotated sideways — and now your users are pinching, zooming, and rage-scrolling. Worse: you "fix" it by rotating the entire document and accidentally ruin pages that were already correct.

Layout breaks = support tickets

"Why is this page sideways?" is a surprisingly expensive question to answer at scale.

Manual fixes don't stick

One new upload, one re-scan, one vendor update… and the rotation bug returns.

Rotation should be deterministic

"It depends on the viewer" is not a product strategy. Your pipeline should output consistently oriented pages.

If this pain starts with a scanner, you're not imagining it: scanned batches often mix orientations inside a single file. That's why page-level rotation matters. For deeper tactics, read our guide on Scanned Documents.

There's a better way: rotate only what's wrong

The Rotate PDF API is built for one job: fix orientation without collateral damage. Choose a rotation angle (90 / 180 / 270) and apply it to the whole document or just specific pages. That means your "good" pages stay untouched — links, layouts, and pagination remain predictable.

Rotate by degrees your pipeline can reason about

Use explicit angles: 90 (clockwise), 180 (upside down), 270 (counter-clockwise). No guessing.

Page targeting that prevents "oops, everything rotated"

Apply rotation to all pages or only the pages you specify (lists + ranges).

Predictable output for viewers, printers, and downstream tools

Stop relying on client-side viewing quirks. Normalize orientation server-side once.

Rotate pages vs rotate whole document
Same endpoint — different parameters
Examples
1) Rotate the entire PDF (change PDF orientation API)
curl -X POST "https://api.xspdf.com/v1/pdf/rotate" \
  -H "Authorization: Bearer $API_KEY" \
  -F "file=@contract.pdf" \
  -F "rotation=180" \
  -F "pages=all" \
  -o "contract.rotated.pdf"
2) Rotate only the broken pages (rotate pages API)
curl -X POST "https://api.xspdf.com/v1/pdf/rotate" \
  -H "Authorization: Bearer $API_KEY" \
  -F "file=@batch.pdf" \
  -F "rotation=270" \
  -F "pages=2,6,10-12" \
  -o "batch.fixed.pdf"
rotation
90 | 180 | 270
pages
all | 3,7,9 | 7-9
output
stream or file

Tip: if you're rotating scanned pages, consider validating orientation early in your ingest pipeline. Our Scanned Documents guide shows what typically goes wrong (and how to prevent repeat fixes).

The hidden win: fewer downstream layout regressions

Rotating only the pages that need it keeps the rest of the document stable—so your QA isn't re-checking every page after every "tiny fix."

What you get (besides correctly oriented pages)

This isn't "rotate a PDF" as a checkbox feature. It's a layout-stability tool: fewer manual interventions, fewer re-uploads, fewer user complaints.

Rotate specific pages without touching the rest

Fix page 3 and 7–9, keep page 1–2 pristine. No "one step forward, two steps back."

Consistent reading experience on every device

Normalize orientation server-side so mobile viewers, web embeds, and printers agree.

Fewer re-uploads and "version soup"

Stop emailing "final_v7_ROTATED.pdf". Fix orientation programmatically in your workflow.

Simple parameters your team won't misuse

Only valid rotations (90/180/270) + clear page targeting means fewer integration bugs.

Safer automation with predictable outputs

The output is a PDF you can trust in downstream steps—merge, sign, extract, or archive.

Works whether you rotate one page or 1,000

From a single sideways invoice to large batches of mixed-orientation scans.

FAQ: Rotate PDF API (the questions people ask right before they integrate)

These are the "wait—what about…" details that decide whether rotation becomes a clean automation or a recurring manual chore.

What rotation values are supported (90, 180, 270)?
Use explicit, deterministic degrees: 90, 180, or 270. This keeps behavior consistent across viewers and prevents "close enough" rotations that create subtle layout issues.
Can I rotate only certain pages instead of the whole document?
Yes. That's the point. Send pages=all to rotate the entire file, or target pages like pages=3,7,9 and ranges like pages=10-12. This is the safest way to fix mixed-orientation PDFs without breaking pages that are already correct.
Is this the same as a "change PDF orientation API"?
In practice, yes: "change orientation" usually means rotating page content to match how it should be read. The key difference is control: you can apply the orientation change to the whole document or only the pages that need it—ideal for scanned batches. If your issues originate from scanning, the Scanned Documents guide shows why mixed orientation happens and how to minimize it.
Will rotating pages affect links, layout, or text extraction?
Rotation is designed to be a layout fix, not a layout gamble. By rotating only the specified pages, you reduce the risk of introducing new issues elsewhere. For pipelines that depend on consistent downstream behavior, normalizing orientation early typically reduces extraction and viewing edge-cases.

Ready to fix orientation issues programmatically?

Start rotating PDFs with precision — no manual re-exports required.