Some test text!

Discord Logo

Chat with us

PDFTron is now Apryse, learn more here.

Go / Guides / Rotate pages



PDFTron is now Apryse, learn more here.

Rotating a PDF page in Go

To rotate a page in a PDF document.

doc := NewPDFDoc(filename)

// Rotate the first page 90 degrees clockwise.
page := doc.GetPage(1)
originalRotation := page.GetRotation()
var rotation int
if originalRotation == PageE_0 {
  rotation = PageE_90
else if originalRotation == PageE_90 {
  rotation = PageE_180
else if originalRotation == PageE_180 {
  rotation = PageE_270
else if originalRotation == PageE_270 {
  rotation = PageE_0
else {
  rotation = Page::E_0

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