Skip to content

How to Rotate PDF pages in a handful of lines (v1.9.3)

Jorj X. McKie edited this page Nov 10, 2016 · 2 revisions

This works with version 1.9.3:

import fitz
doc = fitz.open("file.pdf")
for i in range(len(doc)):                 # len(doc) = doc.pageCount
    doc[i].setRotate(90)                  # doc[i] = doc.loadPage(i)
doc.save(doc.name, incremental = True)

The above takes less than 2 seconds (!) for the 1310 pages of the Adobe manual ...

Clone this wiki locally