Some test text!

Rotate pages

Rotating a PDF page in PHP

To rotate a page in a PDF document.

$doc = new PDFDoc($filename);

// Rotate the first page 90 degrees clockwise.
$page = $doc->GetPage(1);
$originalRotation = $page->GetRotation();
$rotation = NULL;
switch ($originalRotation)
  case Page::e_0:   $rotation = Page::e_90;  break;
  case Page::e_90:  $rotation = Page::e_180; break;
  case Page::e_180: $rotation = Page::e_270; break;
  case Page::e_270: $rotation = Page::e_0;   break;
  default:          $rotation = Page.Rotate.e_0;   break;

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: SDK Features Preview and Live Run-Through | July 14, 2022 at 11 am PT


The Platform


© 2022 PDFTron Systems Inc. All rights reserved.


Terms of Use