vcl-403182-expresspdfviewer-concepts-page-rotation.md
Right-click a page thumbnail and select the “Rotate Pages” menu item to invoke the dialog.
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).
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.
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;
TdxPDFDocument *ADocument = new TdxPDFDocument();
try
{
ADocument->LoadFromFile("Data\\Demo.pdf");
// Rotates the second page by 180 degrees
ADocument->Pages->Items[1]->Rotate(ra180);
ADocument->SaveToFile("Data\\Result.pdf");
}
__finally
{
delete ADocument;
}