We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to rotate a PdfTemplate?

You can rotate a PdfTemplate by applying rotate transform. The PdfTemplate class contains the PdfGraphics property that you can use to apply transformations with. The following code example explains how the PdfTemplates can be rotated with respect to a coordinate.


//Create the template

PdfTemplate template = new PdfTemplate(100, 50);

//Draw the rectangle

template.Graphics.DrawRectangle(PdfBrushes.BurlyWood, new System.Drawing.RectangleF(0, 0, 100, 50));

//Draw the string

template.Graphics.DrawString("Woot", new PdfStandardFont(PdfFontFamily.Helvetica, 10), new PdfSolidBrush(System.Drawing.Color.Black), 5, 5);

//Save the state

PdfGraphicsState state = page.Graphics.Save();

//The Translate transform changes the origin of the coordinate system by prepending the specified translation to the transformation matrix of this Graphics.

page.Graphics.TranslateTransform(position.X, position.Y);

//Rotate the page


//Draw the pdf template after applied rotation

page.Graphics.DrawPdfTemplate(template, PointF.Empty);

//Restore the state


Sample link:


Article ID: Published Date: Last Revised Date: Platform: Control:
3729 02/04/2015 02/04/2015 WinForms PDF
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Please sign in to access our KB

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon