PDF Deskew

Automatically detect and correct skewed (tilted) PDF pages. Preserves text pages as searchable vector content and only rasterizes image pages (e.g. scans).

Straighten tilted PDF pages using a pure-JavaScript pipeline (no external binaries required).

Per-page content-aware processing (important):

  • Image pages (scanned documents): rasterized, skew detected and corrected. This is where deskew matters and rasterizing is harmless.
  • Text pages (including mixed text + image): copied verbatim. Vector text, fonts, and searchability are fully preserved. True skew of vector text is rare — if a whole page is rotated by 90/180/270°, use the PDF Rotate tool instead.
  • Empty pages: copied verbatim.

Optionally, you can force rasterization of text pages via "Rasterize Text Pages" if you genuinely need to deskew vector content.

How it works (image pages):

  1. Each image page is rasterized with pdf.js
  2. Skew angle is detected via horizontal projection-profile variance
  3. The page image is rotated to correct the tilt
  4. A new PDF is assembled

Modes:

  • Auto: detect skew automatically (±15° range, 0.5° resolution)
  • Manual: apply a fixed correction angle

Example Results

2 examples

Auto-Deskew a Scanned Document

Detects and corrects skew on image pages of a scanned PDF, preserving any text pages

pdf_deskewed.pdf View File
View input parameters
{ "sourceFile": "/public/samples/pdf/sample-multipage.pdf", "mode": "auto", "threshold": 0.5, "rasterizeText": "false", "pageRange": "" }

Manual Correction on Specific Pages

Applies a fixed 3° counter-clockwise correction to pages 1-3

pdf_deskewed.pdf View File
View input parameters
{ "sourceFile": "/public/samples/pdf/sample-multipage.pdf", "mode": "manual", "manualAngle": 3, "rasterizeText": "false", "pageRange": "1-3" }

Click to upload file or drag and drop file here

Maximum file size: 100MB Supported formats: application/pdf

Manual correction angle (degrees). Positive value corrects a clockwise tilt. Only used in Manual mode.

Minimum detected skew angle (in degrees) required to apply correction in Auto mode. Smaller values detect subtle tilts.

By default text pages are preserved as searchable vector content (not deskewed). Enable this only if you need to deskew vector text content, accepting loss of text selectability.

Specify pages to deskew (e.g., 1-3,5,7-9). Leave blank to process all pages.

Key Facts

Category
Documents & PDF
Input Types
file, select, number, text
Output Type
file
Sample Coverage
4
API Ready
Yes

Overview

The PDF Deskew tool automatically detects and corrects tilted pages in your PDF documents. Using a content-aware processing pipeline, it straightens scanned image pages while preserving vector text, fonts, and searchability on native text pages without rasterizing them unnecessarily.

When to Use

  • When scanned PDF documents or digitized contracts are tilted, making them difficult to read or process.
  • When you need to straighten skewed pages in a PDF while keeping the searchable vector text intact on non-skewed pages.
  • When you want to apply a specific, uniform rotation angle to correct a known tilt on select pages of a document.

How It Works

  • The tool analyzes the PDF page by page to distinguish between vector text pages and rasterized image scans.
  • For image pages, it detects the skew angle within a ±15° range using horizontal projection-profile variance.
  • It rotates the tilted image pages to correct the alignment while copying text and empty pages verbatim to preserve searchability.
  • The corrected pages are reassembled into a single, straightened PDF document ready for download.

Use Cases

Straightening scanned paper contracts or invoices that were fed crookedly into a document scanner.
Preparing scanned PDF books or archives for optical character recognition (OCR) by aligning the text lines horizontally.
Manually adjusting the tilt of specific pages in a multi-page report using a precise correction angle.

Examples

1. Auto-Aligning Scanned Invoices

Accounts Payable Clerk
Background
Receives batches of scanned invoices from various vendors, many of which are scanned at slight angles, making them hard to read and archive.
Problem
The tilted pages look unprofessional and make manual data entry slow.
How to Use
Upload the scanned PDF, select 'Auto detect skew' mode, set the threshold to 0.5, and run the tool.
Example Config
Mode: Auto, Threshold: 0.5, Rasterize Text: No
Outcome
The skewed pages are automatically straightened, while any native text pages remain fully searchable.

2. Manual Tilt Correction for Specific Pages

Digital Archivist
Background
Digitizing a historical manuscript where pages 1 to 3 were scanned with a consistent 3-degree clockwise tilt.
Problem
Auto-detection might vary slightly across pages, but a uniform 3-degree counter-clockwise correction is needed for consistency.
How to Use
Upload the PDF, switch the mode to 'Manual angle', enter '3' in the manual angle field, and set the page range to '1-3'.
Example Config
Mode: Manual, Manual Angle: 3, Page Range: 1-3
Outcome
Pages 1 through 3 are rotated exactly 3 degrees to correct the tilt, while the rest of the document remains untouched.

Try with Samples

pdf, image, text

Related Hubs

FAQ

Will this tool make my searchable PDF text unselectable?

No. By default, the tool preserves text pages as vector content. Only image-based pages are rasterized and deskewed.

Can I force the tool to deskew pages that contain vector text?

Yes. You can set the 'Rasterize Text Pages' option to 'Yes', though this will convert those pages to images and remove text selectability.

What is the maximum angle the auto-detect mode can correct?

The auto-detect mode can identify and correct skew angles within a range of ±15 degrees with a 0.5-degree resolution.

How do I correct a specific page range instead of the whole document?

Enter the desired pages in the 'Page Range' field (for example, '1-3,5') to limit the deskew process to those pages.

What does the auto-detect threshold option do?

It sets the minimum tilt angle required to trigger a correction, preventing unnecessary processing on pages with negligible skew.

API Documentation

Request Endpoint

POST /en/api/tools/pdf-deskew

Request Parameters

Parameter Name Type Required Description
sourceFile file (Upload required) Yes -
mode select Yes -
manualAngle number No Manual correction angle (degrees). Positive value corrects a clockwise tilt. Only used in Manual mode.
threshold number No Minimum detected skew angle (in degrees) required to apply correction in Auto mode. Smaller values detect subtle tilts.
rasterizeText select No By default text pages are preserved as searchable vector content (not deskewed). Enable this only if you need to deskew vector text content, accepting loss of text selectability.
pageRange text No Specify pages to deskew (e.g., 1-3,5,7-9). Leave blank to process all pages.

File type parameters need to be uploaded first via POST /upload/pdf-deskew to get filePath, then pass filePath to the corresponding file field.

Response Format

{
  "filePath": "/public/processing/randomid.ext",
  "fileName": "output.ext",
  "contentType": "application/octet-stream",
  "size": 1024,
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
File: File

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-pdf-deskew": {
      "name": "pdf-deskew",
      "description": "Automatically detect and correct skewed (tilted) PDF pages. Preserves text pages as searchable vector content and only rasterizes image pages (e.g. scans).",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=pdf-deskew",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

Supports URL file links or Base64 encoding for file parameters.

If you encounter any issues, please contact us at [email protected]