Rotating a PDF page on Server/Desktop

To rotate a page in a PDF document.

1doc := NewPDFDoc(filename)
2
3// Rotate the first page 90 degrees clockwise.
4page := doc.GetPage(1)
5originalRotation := page.GetRotation()
6var rotation int
7if originalRotation == PageE_0 {
8 rotation = PageE_90
9}
10else if originalRotation == PageE_90 {
11 rotation = PageE_180
12}
13else if originalRotation == PageE_180 {
14 rotation = PageE_270
15}
16else if originalRotation == PageE_270 {
17 rotation = PageE_0
18}
19else {
20 rotation = Page::E_0
21}
22page.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