Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Rotate Pages in PDF Viewer

  • 2 minutes to read

#Rotate Pages Dialog

Right-click a page thumbnail and select the “Rotate Pages” menu item to invoke the dialog.

Thumbnails Context Menu

You can rotate the currently selected page or run a batch page rotation. Target page selection takes two steps:

  • Choose all pages, the current page, or specific numbers/ranges.

  • If multiple pages are selected, you can filter the pages further (process only odd/even pages, or only portrait/landscape pages).

Rotate Pages Dialog

#Customize the Rotate Page Dialog’s Behavior

You can call the global ShowRotatePagesDialog procedure to invoke the “Rotate Pages” dialog in code. For instance, you can call the procedure in a UI element’s handler.

If you need to adjust or customize UI elements in the “Rotate Pages” dialog, derive a custom form from the TdxPDFViewerRotatePagesDialogForm class. Assign a reference to the custom dialog form class to the dxPDFViewerPasswordDialogClass global variable.

#Rotate Pages in Code

Call a page object’s Rotate procedure. The following example loads the “Demo.pdf” document, turns the second page upside down, and saves the result to a different file:

var
  ADocument: TdxPDFDocument;
begin
  ADocument := TdxPDFDocument.Create;
  try
    ADocument.LoadFromFile('Data\Demo.pdf');
    // Rotates the second page by 180 degrees
    ADocument.Pages[1].Rotate(ra180);
    ADocument.SaveToFile('Data\Result.pdf');
  finally
    ADocument.Free;
  end;