officefileapi-devexpress-dot-pdf-dot-pdfpagetreeobject-a970cdd2.md
Rotates the document page at the specified angle.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public int Rotate { get; set; }
Public Property Rotate As Integer
| Type | Description |
|---|---|
| Int32 |
An integer value, specifying the page rotation angle (in degrees).
|
The code sample below rotates all document pages.
View Example: How to rotate PDF pages
using DevExpress.Pdf;
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
pdfDocumentProcessor.LoadDocument("..\\..\\docs\\TextRotate.pdf");
int angle = 0;
foreach (PdfPage page in pdfDocumentProcessor.Document.Pages)
{
angle = (angle + 90) % 360;
page.Rotate = angle;
}
pdfDocumentProcessor.SaveDocument("..\\..\\docs\\Rotated.pdf");
}
Imports DevExpress.Pdf
Using pdfDocumentProcessor As New PdfDocumentProcessor()
pdfDocumentProcessor.LoadDocument("..\..\docs\TextRotate.pdf")
Dim angle As Integer = 0
For Each page As PdfPage In pdfDocumentProcessor.Document.Pages
angle = (angle + 90) Mod 360
page.Rotate = angle
Next page
pdfDocumentProcessor.SaveDocument("..\..\docs\Rotated.pdf")
End Using
The following code snippets (auto-collected from DevExpress Examples) contain references to the Rotate property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
pdf-document-api-add-graphics-to-landscape-and-portrait-pages/CS/CreateGraphics/Program.cs#L50
float cropBoxHeight = ConvertFromPdfUnits((float)cropBox.Height, dpiY);
switch (page.Rotate)
{
pdf-document-api-rotate-pdf-pages/CS/PdfPageRotationExample/Program.cs#L13
angle = (angle + 90) % 360;
page.Rotate = angle;
}
pdf-document-api-add-graphics-to-landscape-and-portrait-pages/VB/CreateGraphics/Program.vb#L44
Dim cropBoxHeight As Single = ConvertFromPdfUnits(CSng(cropBox.Height), dpiY)
Select Case page.Rotate
Case 90
pdf-document-api-rotate-pdf-pages/VB/PdfPageRotationExample/Program.vb#L12
angle = (angle + 90) Mod 360
page.Rotate = angle
Next
See Also