Some test text!

Loading...
Guides
Rotate pages

Rotating a PDF page in Python

To rotate a page in a PDF document.

doc = PDFDoc(filename)

# Rotate the first page 90 degrees clockwise.
page = doc.GetPage(1)
originalRotation = page.GetRotation()
rotation = None
if originalRotation == Page.e_0:
  rotation = Page.e_90
elif originalRotation == Page.e_90:
  rotation = Page.e_180
elif originalRotation == Page.e_180:
  rotation = Page.e_270
elif originalRotation == Page.e_270:
  rotation = Page.e_0
else
  rotation = Page.e_0
page.SetRotation(rotation)

About rotating pages

A page can be rotated clockwise, by 90 degrees, when displayed or printed. The Page.GetRotation() method returns the Page.Rotate enum specifying the current rotation. Similarly, Page.SetRotation() sets the current rotation.

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use