IronPDF How-Tos Rotating Text and PDF Pages Rotate PDF Text and Pages in .NET Chaknith Bin Updated:June 22, 2025 Rotating PDF text or pages refers to changing the orientation of either the entire page or specific text elements within a PDF document. This rotation can be carried out in degrees (typically 90, 180, or 270 degrees) to reposition content either clockwise or counterclockwise. Get started with IronPDF Start using IronPDF in your project today with a free trial. First Step: Start for Free How to Rotate PDF File in C# Download IronPDF C# PDF Library to rotate PDF Use the provided methods to set page rotation Rotate PDF Pages Programmatically Use CSS3 to Rotate PDF Text View your PDF Document Rotate PDF Pages Use the SetPageRotation, SetPageRotations, and SetAllPageRotations methods to set rotation for a single page, multiple pages, and all pages, respectively. These methods completely overwrite the current page rotation with the specified degree, measured clockwise. If the original page rotation is set to the desired degree, the methods would not affect the output file. :path=/static-assets/pdf/content-code-examples/how-to/rotating-text-set-page-rotation.cs using IronPdf; using IronPdf.Rendering; using System.Linq; // Import PDF PdfDocument pdf = PdfDocument.FromFile("multi-page.pdf"); // Set rotation for a single page pdf.SetPageRotation(0, PdfPageRotation.Clockwise90); // Set rotation for multiple pages pdf.SetPageRotations(Enumerable.Range(1,3), PdfPageRotation.Clockwise270); // Set rotation for the entire document pdf.SetAllPageRotations(PdfPageRotation.Clockwise180); pdf.SaveAs("rotated.pdf"); Imports IronPdf Imports IronPdf.Rendering Imports System.Linq ' Import PDF Private pdf As PdfDocument = PdfDocument.FromFile("multi-page.pdf") ' Set rotation for a single page pdf.SetPageRotation(0, PdfPageRotation.Clockwise90) ' Set rotation for multiple pages pdf.SetPageRotations(Enumerable.Range(1,3), PdfPageRotation.Clockwise270) ' Set rotation for the entire document pdf.SetAllPageRotations(PdfPageRotation.Clockwise180) pdf.SaveAs("rotated.pdf") $vbLabelText $csharpLabel Use CSS3 to Rotate Text After converting HTML to PDF in .NET, there might be a need to programmatically rotate text or entire pages. A frequent requirement is to render vertically aligned text in PDFs using HTML5 and CSS3. Here’s how you can achieve this. CSS3 allows text rotation to any angle after converting a PDF to HTML using the IronPDF .NET Library you installed earlier. This is achieved using the transform: rotate(...) CSS3 style, which can rotate any HTML element to any angle. :path=/static-assets/pdf/content-code-examples/how-to/rotating-text-css.cs using IronPdf; var renderer = new IronPdf.ChromePdfRenderer(); var pdf = renderer.RenderHtmlAsPdf(@" <html> <head> <style> .rotated{ -webkit-transform: rotate(-180deg); width:400; height:400; } </style> </head> <body> <p class='rotated'>Rotated Text</p> </body> </html> "); pdf.SaveAs("rotated.pdf"); Imports IronPdf Private renderer = New IronPdf.ChromePdfRenderer() Private pdf = renderer.RenderHtmlAsPdf(" <html> <head> <style> .rotated{ -webkit-transform: rotate(-180deg); width:400; height:400; } </style> </head> <body> <p class='rotated'>Rotated Text</p> </body> </html> ") pdf.SaveAs("rotated.pdf") $vbLabelText $csharpLabel Ready to see what else you can do? Check out our tutorial page here: Edit PDFs Frequently Asked Questions How can I rotate a PDF file in C#? You can rotate a PDF file in C# by using the IronPDF library. First, download IronPDF from NuGet and use methods like SetPageRotation to specify the desired rotation for PDF pages programmatically. What methods are available for rotating PDF pages? IronPDF provides methods such as SetPageRotation, SetPageRotations, and SetAllPageRotations. These methods allow you to rotate a single page, multiple pages, or all pages by specifying the degree of rotation. Can CSS3 be used to rotate text in a PDF? Yes, after converting HTML to PDF using IronPDF, you can apply CSS3 styles like transform: rotate(...) to rotate text elements within the PDF to any desired angle. How do I save a rotated PDF in C#? After applying rotations to your PDF using IronPDF, you can save the modified PDF by using the SaveAs method, specifying the desired filename for the rotated PDF. Why use HTML5 and CSS3 for text rotation in PDFs? HTML5 and CSS3 provide precise control over text rotation in PDFs. By converting HTML to PDF with IronPDF, you can apply CSS3 rotations like transform: rotate(...) to achieve custom text orientations and layouts. Is it possible to rotate only specific text elements in a PDF? Yes, IronPDF allows you to rotate specific text elements within a PDF by using CSS3 styles during HTML to PDF conversion, enabling precise control over individual text orientation. What degree options are available for rotating PDF pages? PDF pages can be rotated in degrees such as 90, 180, or 270. These options allow you to reposition content either clockwise or counterclockwise using IronPDF. How can I rotate multiple pages in a PDF document? Use the SetPageRotations method from IronPDF to rotate multiple pages within a PDF document by specifying the desired degree of rotation for each page. Chaknith Bin Chat with engineering team now Software Engineer Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience. Ready to Get Started? Free NuGet Download Total downloads: 15,030,178 View Licenses