Rotating a PDF page on Server/Desktop

To rotate a page in a PDF document.

1doc = PDFDoc.new(filename)
2
3# Rotate the first page 90 degrees clockwise.
4page = doc.GetPage(1)
5originalRotation = page.GetRotation()
6rotation = nil
7if originalRotation == Page::E_0
8 rotation = Page::E_90
9elsif originalRotation == Page::E_90
10 rotation = Page::E_180
11elsif originalRotation == Page::E_180
12 rotation = Page::E_270
13elsif originalRotation == Page::E_270
14 rotation = Page::E_0
15else
16 rotation = Page::E_0
17end
18page.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.

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales