For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rotating a PDF page on iOS

To rotate a page in a PDF document.

PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];

// Rotate the first page 90 degrees clockwise.
PTPage *page = [doc GetPage:1];
PTRotate originalRotation = [page getRotation];
PTRotate rotation;
switch (originalRotation)
{
  case e_pt0:   rotation = e_pt90;  break;
  case e_pt90:  rotation = e_pt180; break;
  case e_pt180: rotation = e_pt270; break;
  case e_pt270: rotation = e_pt0;   break;
  default:      rotation = e_pt0;   break;
}
[page SetRotation: rotation];
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)

// Rotate the first page 90 degrees clockwise.
let page: PTPage = doc.getPage(1)
let originalRotation: PTRotate = page.getRotation()
var rotation: PTRotate
switch (originalRotation)
{
  case e_pt0:   rotation = e_pt90
  case e_pt90:  rotation = e_pt180
  case e_pt180: rotation = e_pt270
  case e_pt270: rotation = e_pt0
  default:      rotation = e_pt0
}
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.

Last updated

Was this helpful?