Tips & Tricks

How to OCR a PDF With Mixed Landscape and Portrait Pages

A scanned PDF assembled from mixed sources often contains pages in both portrait and landscape orientation. Financial spreadsheets appear as landscape pages. Accompanying text documents appear as portrait pages. Running OCR on such a document without accounting for mixed orientations produces recognized text where words on landscape pages are scrambled, rotated, or entirely missed because the OCR engine processed those pages in the wrong orientation.

OCR PDF engines analyze text lines to determine character positions and reading order. When a page is rotated 90 degrees relative to what the engine expects, the text lines run vertically instead of horizontally. The engine either fails to recognize the text entirely or attempts to read vertically, producing nonsense output. Mixed-orientation documents require per-page orientation detection before OCR processing.

WukongPDF's Scanned PDF OCR tools handle mixed page orientations with automatic rotation detection for each page during the recognition process.

Why Page Orientation Matters for OCR Accuracy

OCR engines work by detecting rows of characters and analyzing the shapes within each row. A page in portrait orientation has text lines running horizontally, which the engine processes naturally. A page in landscape orientation, when viewed without rotation correction, has text lines running vertically from the OCR engine's perspective. The engine expects horizontal text and cannot read vertical text.

The solution is to detect each page's orientation before OCR and rotate landscape pages to portrait orientation before processing. After OCR, the pages can be rotated back to their original orientation with the recognized text layer correctly positioned. The rotation during processing does not permanently change the document; it only changes how the OCR engine sees the page.

Most automated OCR tools assume all pages share the same orientation because that is the common case for documents produced by a single scanner in a single session. Mixed-orientation documents, often created by combining scans from different sources, require explicit configuration to handle the per-page variation correctly.

Method 1: Acrobat Pro With Per-Page Rotation Detection

Acrobat Pro's OCR feature can process mixed-orientation documents when configured appropriately. Open the scanned PDF in Acrobat Pro and go to Tools, Scan and OCR, Recognize Text, In This File. In the Recognize Text settings dialog, ensure the correct OCR language is selected for the document's primary language. Under the Settings section, enable the Deskew and Straighten option, which helps Acrobat detect page rotation.

Acrobat processes each page individually and attempts to detect the dominant text orientation. For pages where the detection is correct, the OCR output is accurate and readable. For pages where the detection fails, such as those with minimal text or complex visual backgrounds, the OCR output may be scrambled or entirely absent. After OCR processing, specifically review the landscape pages. Search for text that you can see visually on those pages. If the search finds nothing, Acrobat likely misidentified the orientation.

For pages that were misidentified, manually rotate them in the Organize Pages tool and re-run OCR on just those pages. The manual intervention takes only a moment per affected page and ensures that every page contributes accurate recognized text to the searchable document output.

Method 2: Pre-Processing With OCRmyPDF

OCRmyPDF, an open-source command-line tool built on Tesseract OCR, handles mixed-orientation pages through its built-in deskew feature. The command ocrmypdf --deskew input.pdf output.pdf detects the text orientation on each page, rotates pages as necessary, runs OCR with Tesseract, and outputs a searchable PDF. The deskew flag is the essential parameter for mixed-orientation document processing.

OCRmyPDF processes pages sequentially and applies per-page orientation correction automatically. For documents with extreme rotation or pages containing both horizontal and vertical text, the deskew algorithm orients the page based on the dominant text direction, which provides the best OCR results for the majority of the page content. The minority text direction may have slightly reduced accuracy but is generally still recognized.

In document workflows, for high-volume batch processing of mixed-orientation documents, OCRmyPDF combined with a shell script that processes all PDFs in a folder provides fully automated OCR without manual per-document configuration. The automation handles the routine processing, and only exception cases require human review.

Verifying OCR Output on Landscape Pages Specifically

After OCR processing, verify the output on landscape pages as a separate focused check. Select text on a landscape page in the output PDF and copy it to a plain text editor. The copied text should read in the correct order, matching the visual page content from top to bottom and left to right. If words are scrambled, out of order, or appear in nonsensical sequences, the orientation detection failed for that page.

Search for specific known terms that appear on landscape pages. A financial table on a landscape page might contain specific account codes, department names, or numeric values that you can search for in the OCR output. If the search finds no matches on landscape pages but finds matches on portrait pages from the same document, the OCR engine likely missed the landscape content entirely. These pages need re-processing with manual orientation specified.

In document workflows, for documents that will serve as searchable archives, the verification step is a quality gate that catches orientation-related OCR issues before the document enters the permanent collection. An unverified OCR output that silently misses entire pages of content undermines the purpose of creating a searchable archive.

Batch Processing Mixed-Orientation Scanned Collections

For large collections of scanned documents with mixed orientations, manual per-page verification is impractical. Automate the process with OCRmyPDF and the deskew flag, then run a verification script that checks each output page for the presence of searchable text. Pages with zero recognized text characters or very few characters are flagged for manual review and potential re-processing.

The verification script reads each OCR-processed PDF, extracts the text layer page by page, and counts the number of recognized characters on each page. Any page below a minimum character threshold, such as ten characters, is flagged as potentially unprocessed or misoriented. The flagged pages are compiled into a report that guides the manual review effort to only the pages that actually need human attention, rather than requiring review of every page.

Regarding workflows, for ongoing digitization projects where new scanned documents arrive regularly, the batch processing and verification workflow becomes a standard operating procedure. New documents enter the pipeline, are processed automatically through OCR with orientation detection, and only exceptions require human intervention. The automation handles the routine. The human reviewer handles the exceptions.

Improving OCR on Pages With Internal Rotation

Some scanned documents contain pages where content is rotated within the page rather than the page itself being rotated. A landscape financial table might be inserted into a portrait document by rotating the table content 90 degrees while keeping the page dimensions portrait. These pages are the most challenging for orientation detection because the page dimensions provide no indication that rotation is needed.

With document processing, for pages with internal rotation, manual preprocessing is the most reliable approach. In Acrobat Pro, use the Edit PDF tool to select the rotated content area, rotate it to the correct horizontal orientation, and position it properly on the page. After correcting the internal rotation, run OCR on the corrected page. The manual preprocessing step takes about a minute per affected page but produces clean and accurate OCR output.

Identifying pages with internal rotation requires visual inspection. Scan through the document and look for pages where the text appears to run in an unexpected direction relative to the page edges. Pages with internal rotation are relatively rare in most document collections but disproportionately affect OCR quality when they occur.

Choosing the Right OCR Engine for Mixed-Orientation Documents

Different OCR engines handle orientation detection with varying accuracy. Tesseract with the deskew preprocessor handles moderate rotation well but may struggle with pages rotated exactly 90 or 180 degrees. Google Cloud Vision OCR includes built-in orientation detection that handles all rotation angles reliably. For critical mixed-orientation documents where accuracy is essential, cloud-based OCR services generally outperform local engines on orientation handling.

Test the chosen OCR engine on a small sample of mixed-orientation pages before committing to a large batch. A ten-page test with known orientation patterns reveals how the engine handles the specific rotation types in your documents. The test takes minutes and prevents hours of re-processing if the engine orientation detection proves inadequate for your particular document types.

Exporting OCR Text From Mixed-Orientation Documents for Verification

After OCR processing, export the recognized text to verify completeness across all pages. In Acrobat Pro, go to Tools, Export PDF, and choose Text as the output format. The exported text file should contain content from every page in the correct reading order. Open the text file and search for terms you know appear on specific landscape pages. If those terms are missing from the export, those pages were likely misoriented during OCR and need re-processing.

Concerning document handling, for documents destined for searchable archives, the exported text serves as an independent verification that every page contributed its content to the searchable layer. A text export that has gaps or missing sections indicates OCR failures that require attention before the document enters the permanent archive. The export step functions as a quality gate that catches orientation-related OCR issues before they become permanent archive deficiencies.

WukongPDF

Try PDF OCR

No installation needed. Works directly in your browser.

Get Started โ†’