Free plan

Auto-rotate pages

Turn sideways or upside-down scanned pages the right way up
POST
/v1/pdfs/auto-rotate

About this tool

This tool finds pages that were scanned sideways or upside down and turns them upright. By default it reads the text on each page to work out which way is up, so the page needs real text. You can instead turn every wide page, or every tall page, by a quarter turn. A preview option shows which pages would be turned without changing anything.
For example, you fix a scan where some pages came out rotated.

How to use it

  1. Choose this tool.
  2. Add your PDF with Upload or drag and drop.
  3. Choose how to find the right way up: from the text, or turn all wide or all tall pages.
  4. Optionally choose which pages to check.
  5. Press Generate, then download the PDF.

What you get back

You get a new PDF with the pages upright. If you only preview, you get a list of the pages that would be turned.
GOOD TO KNOW
The turn is stored in the page rotation; the page content is not redrawn. A page with too little text cannot be detected and is left alone. Counts as one PDF operation.
TEST IT LIVE

Try Auto-rotate pages in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
PDFs
Plan
Free
Method
POST
Endpoint
/v1/pdfs/auto-rotate
Tool ID
pdfs.auto-rotate
Authentication
API key
Accepts
PDF
Background jobs
Yes
Usage group
Pdf
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/auto-rotate" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'pages=1-3' \
  -F 'mode=osd' \
  -F 'min_confidence=2'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.pdfs.autoRotate({
    "file": 'document.pdf',
    "pages": "1-3",
    "mode": "osd",
    "min_confidence": 2
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->pdfs()->autoRotate([
    'file' => 'document.pdf',
    'pages' => '1-3',
    'mode' => 'osd',
    'min_confidence' => 2,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Turn sideways and upside-down scanned pages upright: the text of each page is read to find its orientation, or every wide (or tall) page is turned a quarter.

Auto-rotate pages accepts PDF. You can send several files in one request.

Auto-rotate pages is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/pdfs/auto-rotate with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.