You open a scanned contract, page three is on its side, you press the rotate button, read it, close the file. The next morning page three is on its side again. Nothing went wrong with the file. The button you pressed turned the window you were looking through, and the page never knew. A PDF page carries its orientation inside the file as a single number, and unless that number changes, every reader on every device will keep showing the page the way it did before.
One Number on Each Page
ISO 32000, the PDF standard, describes every page as a dictionary of entries: the paper size (MediaBox), the content streams with the drawing instructions, the resources they use, and an optional entry called Rotate. Section 7.7.3.3 defines Rotate as the number of degrees by which the page shall be rotated clockwise when it is displayed or printed. The value must be a multiple of 90 and defaults to 0.
That makes rotation a display instruction, not an edit. The text and images on the page are stored exactly as they were drawn. A reader takes them, lays them out on the paper, and then turns the finished page clockwise by the stated amount. An A4 page of 595 × 842 points with Rotate set to 90 is shown and printed as a landscape sheet of 842 × 595, while the numbers in the MediaBox never change.
Rotate is also inheritable (section 7.7.3.4). A node in the page tree can carry it for all the pages below, and any page without its own value takes the one above. A rotation tool therefore has to read the value a page actually inherits, not just what is written on the page, or it will add its quarter turn to the wrong starting point.
Rotating the View Is Not Rotating the Page
PDF readers offer two different things under similar names. One turns the view: the reader draws every page turned for as long as the window is open, and nothing in the file changes. The other changes the Rotate entry of the pages and needs the file to be saved. Adobe Acrobat keeps them apart as Rotate View, in the View menu, and the page rotation commands under Organize Pages. Only the second survives closing the file, and only if you then save.
The view kind is the one most people meet first, because it is the button in the toolbar of browsers and light readers. It is useful for reading a single sideways table, and useless for a file you are about to send, because the person who receives it starts with the page the way it is stored.
Four Places a Page's Orientation Can Come From
What decides how a page appears, and whether a fix travels with the file.
| Source | Stored in the file | How to change it |
|---|---|---|
| View rotation in a reader | No | Turn it back, or close the file |
| The page's Rotate entry | Yes, one number per page | A page rotation tool, then save |
| The shape of the MediaBox | Yes | Recreate or reprint the page |
| Content drawn on its side | Yes, in the content stream | Rotate the page to compensate |
Why Scans Come Out Sideways or Upside Down
A scanner records what passes the sensor, in the direction it passes. Feed a landscape spreadsheet into a portrait feeder and the page is captured on its side, with Rotate left at 0, because the scanner has no idea which way is up. Some scanning software guesses from the text and sets the rotation, many do not, and guessing fails on pages with little text.
Double-sided scans add a second problem. The back of each sheet is captured after the sheet is turned over, and whether that back side comes out upright depends on whether the scanner assumes the pages flip on the long edge, like a book, or on the short edge, like a wall calendar. When the assumption does not match the paper, every even page in the file comes out upside down while every odd page is fine. The fix is a half turn on the even pages only, which a tool that can pick odd or even pages does in one step.
Two programs can disagree about the same page
Software that reads a page's size from the MediaBox without applying Rotate will report a rotated A4 page as portrait while every reader shows it as landscape. The PDF library pdf-lib behaves this way: its getSize returns the box as stored, and the rotation has to be applied separately. If an upload form, a print shop or a page-imposition tool insists your landscape page is portrait, this is usually why, and the reliable fix is to give it a file whose pages were created landscape rather than turned.
Turn your pages and keep the turn
Rotate one page, every page or only the odd or even ones, and download a file that opens the right way up anywhere.
What a Saved Rotation Changes, and What It Leaves Alone
Because only one entry per page is rewritten, a rotation is one of the gentlest edits a PDF can go through.
Untouched: text, images and quality
The content streams are not redrawn, so text stays selectable and searchable and images keep the compression they arrived with. A rotated scan is exactly as sharp as before.
Untouched: bookmarks, links and form fields
The document is saved as a whole rather than copied page by page, so the outline, internal links, form fields and attachments stay attached to the catalog that holds them.
Changed: the bytes of the file
Any digital signature covers the exact bytes of the file it signed. A rotation changes them, so a signed document will show its signature as invalid or the document as modified afterwards. Keep the signed original and rotate a copy.
Not possible: angles in between
The standard only allows multiples of 90 degrees. A scan that is a few degrees crooked has to be straightened in the image itself, before or after it goes into the PDF.
Frequently Asked Questions
Related Tools
Keep Reading
Splitting a PDF: Why the Parts Weigh More Than the Whole
One shared font becomes twenty copies, a contents page can drag the whole document along, and edit history quietly drops out. Where the bytes go in a split.
Merging PDFs: What Comes Through and What Quietly Disappears
A merge copies pages, not documents. Text and images arrive untouched; bookmarks, form fields and signatures do not, and the reason is in the file format.
Turning a PDF Page Into an Image: DPI, Size and Format
A PDF page has inches, not pixels, so the DPI you choose sets the image size. What each resolution is for, why JPG smudges text, and why Word gets the size wrong.