Other PDF Issues

How to Correct PDF Page Rotation Using Acrobat JavaScript

Chanuka GeekiyanageChanuka Geekiyanage Nov 3, 2026 868 views

Question details

Fix portrait PDF pages that report a 270-degree rotation during a batch JavaScript process without using OCR.

How to Correct PDF Page Rotation Using Acrobat JavaScript
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Running a batch Acrobat JavaScript process to add stamps or annotations to PDFs where certain portrait pages have an improper rotation value.
Observed behavior
Setting the rotation value to zero changes the page to landscape because of the underlying coordinate system, and JavaScript lacks a simple upright conversion command.
Before you start

Before running any batch scripts or preflight fixups on your documents, make sure to back up your original PDF files to prevent permanent loss of original formatting.

Solution 1Recommended

Normalize Rotation Using Acrobat Preflight Fixup

Use Adobe Acrobat's Preflight tool to permanently correct page rotation and geometry before running your annotation JavaScript.

Because Acrobat JavaScript simply modifies the rotation property of the existing coordinate system, setting a 270-degree page to zero will often flip it horizontally into landscape. Normalizing the document with a Preflight profile rewrites the internal geometry so all pages become upright with a true 0-degree property.

1
Open Preflight Tools

In Adobe Acrobat, navigate to Tools, select Print Production, and then click on Preflight.

2
Access PDF Fixups

Click the wrench icon to view the available Fixups profiles.

3
Apply Rotation Normalization

Search for 'rotation' or 'page geometry' fixups. Select a profile that normalizes page rotation or permanently sets page orientation, and click 'Fix'.

4
Run JavaScript

Once the document is normalized and all pages are upright, execute your batch JavaScript process to apply stamps or annotations without coordinate conflicts.

Normalize Rotation Using Acrobat Preflight Fixup
Test Coordinates: Normalizing page rotation will shift the underlying coordinate system. You must carefully test your JavaScript annotation coordinates to ensure stamps appear in the correct locations.

Organize and Edit PDF Pages Easily with WPS Office

If managing PDF page coordinates and batch JavaScripts is slowing down your workflow, WPS PDF offers an intuitive interface to easily rotate pages, add annotations, and normalize your documents without writing complex code.

  1. 1. Open PDF in WPS Office: Launch WPS Office and open your PDF document using the WPS PDF editor.
  2. 2. Navigate to the Page Tab: Click on the 'Page' tab located in the top navigation menu to view all pages as thumbnails.
  3. 3. Rotate Pages: Select the pages that need correction and click the 'Rotate Clockwise' or 'Rotate Counterclockwise' buttons to make them upright.
  4. 4. Add Annotations: Switch to the 'Comment' tab to quickly insert text boxes, stamps, and other annotations exactly where you need them.
Easily rotate individual or multiple PDF pages to the correct upright orientation visually.Add stamps, watermarks, and comments using a user-friendly interface instead of complex scripts.Fully compatible with standard PDF formats and Adobe Acrobat files.Lightweight alternative for everyday PDF document management and editing.
microsoft office alternative - wps office

Frequently Asked Questions

Why does setting PDF page rotation to zero make my portrait page landscape?

PDF page rotation relies on the document's original coordinate system (MediaBox). If the page was originally created or scanned in landscape mode and then rotated 270 degrees to look like a portrait, setting the rotation property back to zero simply removes that visual adjustment, exposing the original landscape geometry.

Does Acrobat JavaScript have an 'upright' command for PDF pages?

No, Acrobat JavaScript primarily modifies the visual rotation property using functions like setPageRotations(). It does not have a native method to permanently rewrite the internal page geometry or media boxes to simulate an 'upright' command like some external PDF processors do.

Can I permanently change PDF page orientation without using OCR?

Yes. You can permanently alter the orientation by using Adobe Acrobat's Print Production Preflight fixups to normalize page geometry or by processing the file through external command-line tools like Coherent PDF. Neither method requires optical character recognition (OCR) or makes the document searchable.