officefileapi-devexpress-dot-pdf-dot-pdfgraphics-dot-rotatetransform-x28-system-dot-single-x29.md
Rotates the coordinate system clockwise to the specified angle relative to its origin.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Drawing.dll
NuGet Package : DevExpress.Pdf.Drawing
public void RotateTransform(
float degree
)
Public Sub RotateTransform(
degree As Single
)
| Name | Type | Description |
|---|---|---|
| degree | Single |
Angle of rotation in degrees.
|
This method multiplies the transformation matrix of the PdfGraphics object by a rotation matrix. Elements of the rotation matrix are derived from the degree parameter.
Note
Coordinate system transformations (for example, system rotation) are not taken into account for the following methods:
the following code snippet rotates the coordinate system and draws shapes in the initial and rotated coordinate systems.
using DevExpress.Pdf;
using DevExpress.Drawing;
//...
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
processor.CreateEmptyDocument();
PdfPage page = processor.AddNewPage(PdfPaperSize.A4);
using (PdfGraphics graphics = processor.CreateGraphicsWorld( ))
{
// Draw a green rectangle.
using (var brush = new DXSolidBrush(Color.Green))
graphics.FillRectangle(brush, new RectangleF(0, 0, 300, 200));
// Rotate the coordinate system clockwise by 90 degrees.
graphics.RotateTransform(90);
// Draw a blue rectangle in the rotated coordinate system.
using (var brush = new DXSolidBrush(Color.Blue))
graphics.FillRectangle(brush, new RectangleF(0, -350, 300, -200));
// Add graphics content to the document page.
graphics.AddToPageForeground(page);
}
processor.SaveDocument("out2.pdf");
}
Process.Start("out.pdf");
Imports DevExpress.Pdf
Imports System.Drawing
'...
Using processor As New PdfDocumentProcessor()
processor.CreateEmptyDocument()
Dim page As PdfPage = processor.AddNewPage(PdfPaperSize.A4)
Using graphics As PdfGraphics = processor.CreateGraphicsWorld( )
' Draw a green rectangle.
Using brush = New DXSolidBrush(Color.Green)
graphics.FillRectangle(brush, New RectangleF(0, 0, 300, 200))
End Using
' Rotate the coordinate system clockwise by 90 degrees.
graphics.RotateTransform(90)
' Draw a blue rectangle in the rotated coordinate system.
Using brush = New DXSolidBrush(Color.Blue)
graphics.FillRectangle(brush, New RectangleF(0, -350, 300, -200))
End Using
' Add graphics content to the document page.
graphics.AddToPageForeground(page)
End Using
processor.SaveDocument("out2.pdf")
End Using
Process.Start("out.pdf")
The following code snippets (auto-collected from DevExpress Examples) contain references to the RotateTransform(Single) method.
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#L53
case 90:
graphics.RotateTransform(-90);
graphics.TranslateTransform(-cropBoxHeight, 0);
pdf-document-api-generate-document-layout/CS/DocumentCreationAPI/Program.cs#L61
graphics.TranslateTransform((float)(page.CropBox.Width * 0.5),(float)(page.CropBox.Height * 0.5));
graphics.RotateTransform((float)45.0);
graphics.TranslateTransform((float)(-stringSize.Width * scale * 0.5),(float)(-stringSize.Height * scale * 0.5));
pdf-document-api-add-graphics-to-landscape-and-portrait-pages/VB/CreateGraphics/Program.vb#L46
Case 90
graphics.RotateTransform(-90)
graphics.TranslateTransform(-cropBoxHeight, 0)
pdf-document-api-generate-document-layout/VB/DocumentCreationAPI/Program.vb#L62
graphics.TranslateTransform(CSng(page.CropBox.Width * 0.5), CSng(page.CropBox.Height * 0.5))
graphics.RotateTransform(45.0)
graphics.TranslateTransform(CSng(-stringSize.Width * scale * 0.5), CSng(-stringSize.Height * scale * 0.5))
See Also