Rotate PDF

Fix the orientation of some or all pages. Free, no upload. 1 GB max · Up to 1 GB · Processed locally, never sent to a server.

A sheet feeder that swallows a stack the wrong way round, a phone that saves a photo of a document sideways, a landscape annex slipped into the middle of a portrait report: orientation is the most ordinary defect a PDF can have, and one of the most tiring to put up with when you have to tilt your head at every page.

The operation offered here is of a particular kind: it does not touch the content. pdf-lib opens the document, changes a single value in the description of each targeted page, the display rotation angle, then writes the file back out. Text stays text, images are not recompressed, fonts are not rebuilt, links stay clickable.

A PDF reader finds an orientation instruction in every page and applies it before drawing anything at all. Changing that instruction is like turning the sheet round on your desk, not reprinting the document. The file size barely moves, nothing degrades along the way, and you can chain as many attempts as it takes to land on the right way up without ever damaging the original.

How to use it

  1. Drop in the badly oriented document An encrypted PDF is turned away with a message saying the file could not be read. Any other valid PDF goes through, whatever its page count.
  2. Choose the angle Three values only: 90° for a quarter turn to the right, 180° for a page upside down, 270° for a quarter turn to the left.
  3. Target the pages concerned Leave the field empty for the whole document, or type “2, 4-6”. Numbers outside the document are dropped, and a reversed range such as “6-4” is put back the right way round.
  4. Click Run The angle is added to the rotation already recorded in each page rather than replacing it. A page already turned by 90° will therefore end up at 180°.
  5. Check the -pivote.pdf file The note says how many pages were turned and by what angle. Open the result before you archive it; it is the fastest check there is.

What rotation changes, and what it does not

Every page of a PDF carries a rotation entry, expressed in multiples of 90 degrees. That entry is the only thing the tool modifies: the stream of drawing instructions, the fonts and the images are neither read back nor rewritten, which is why there is no loss of quality at all.

The physical page size does not move either. An A4 portrait page turned by a quarter is still described as a page of 595 by 842 points, and it is the reader that displays it on its side. That subtlety explains a few surprises at print time: most drivers take the rotation into account, a handful reason on the declared page size instead.

Text extraction keeps working exactly as before. Copying a paragraph out of a rotated page returns the same text, in the same order, because nothing has moved in the document’s internal coordinates.

Rotations add up

The angle you ask for is added to the existing value, and the total is brought back inside the 360 degree range. On a fresh document, where the pages sit at zero, the behaviour is the one you would expect. On a document that has already been through something else, and plenty of scanners write a rotation of their own, the result depends on the starting state.

So do not think in absolute values, think in relative correction: look at how the page displays today, decide which quarter turn puts it straight, apply it. A wrong turn is undone by a second pass at 180°, and three passes at 90° bring you back to where you started with no consequence for the file.

The real cases, and the one that is not one

The most frequent case is the batch scanned upside down: the feeder took the stack the wrong way round and every page sits at 180 degrees. The Pages field stays empty, the angle goes to 180, and one operation is enough.

The second case is mixed. A portrait report contains two or three landscape annexes, a floor plan or a wide table exported from a spreadsheet, inserted sideways. The page range does all the work here, and two passes are enough when the annexes do not turn the same way. The same need comes up with phone photographs of documents later assembled into a PDF.

The third case is not really a case. A page that is slightly askew, tilted by two or three degrees because the sheet slipped in the scanner, cannot be fixed here: PDF rotation only knows quarter turns. Fine deskewing is image processing, which means converting the page to pixels and turning those, with the loss of quality that implies.

Before rotating an important document

The file is entirely rewritten by pdf-lib, even though the visible content does not change. A certified electronic signature already present in the document will not survive that rewrite, since the verification covered the original bytes. Keep the original if the document has evidentiary value.

The document only makes a round trip through the tab’s memory: read it, change one integer per page, write a new file and offer it for download. No network request carries its content; the only one that goes out fetches pdf-lib from this site’s own files.

Frequently asked questions

Does rotating degrade quality?

No. No image is recompressed and no text is rewritten: the tool changes one integer in the description of each page and saves. You can chain ten rotations without losing a pixel, unlike a correction that would go through a conversion to an image.

Why did my page turn by 180° when I asked for 90°?

Because it already carried a rotation of 90 degrees, written by the scanner or by an earlier piece of software. The angle you ask for is added to what is there. Start again from the original file and choose the angle that is genuinely missing.

Can I turn pages in different directions?

Yes, in two passes. Handle the pages that need turning to the right first, with the matching range, download the result, drop it back in and handle the others at 270°.

Does the file size change?

Barely, and not always in the direction you would expect. pdf-lib rewrites the structure of the document, which can compact some objects and add a few others. On an ordinary file the difference is measured in kilobytes.

My page is straight on screen but prints sideways

The reader applies the rotation instruction, while printing follows the declared page size, which has not changed. In the print dialog, force the orientation or switch on fit to page.

What does the invalid page range message mean?

The field only accepts numbers and intervals separated by commas. An entry such as “3 to 7” or “end” triggers that message, which repeats the expected format. Numbers larger than the page count are simply ignored, unless none of them is valid.

Similar tools

Discover other tools

Categories