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 What is PDF text and page rotation? PDF text and page rotation refers to changing the orientation of either the entire page or specific text elements within a PDF document. This is often done in degrees, typically 90, 180, or 270 degrees, to reposition content either clockwise or counterclockwise. How can I rotate a PDF file in C#? To rotate a PDF file in C#, you need to download the IronPDF C# PDF Library and use its methods such as SetPageRotation to specify the desired page rotation. You can then programmatically rotate the PDF pages. Which methods are available for rotating PDF pages? IronPDF provides methods like SetPageRotation, SetPageRotations, and SetAllPageRotations. These methods allow you to set rotation for a single page, multiple pages, or all pages, respectively, by specifying the degree of rotation. Can I use CSS3 to rotate text in a PDF? Yes, you can use CSS3 to rotate text in a PDF. After converting HTML to PDF using IronPDF, you can apply CSS3 styles such as transform: rotate(...) to rotate text to any angle. How do I save a rotated PDF? After applying the desired rotations to your PDF using IronPDF, you can save the modified PDF by using the SaveAs method, specifying the filename for the rotated PDF. What is the benefit of using HTML5 and CSS3 for text rotation in PDFs? Using HTML5 and CSS3 allows for flexible and precise control over text rotation in PDFs. You can render vertically aligned text or apply custom rotations to any HTML element, making it easier to achieve the desired layout. What programming language is used for rotating PDF text and pages? IronPDF uses C# for rotating PDF text and pages. You can integrate it into your .NET applications to perform these operations programmatically. Is it possible to rotate specific text elements within a PDF? Yes, IronPDF allows you to rotate specific text elements within a PDF by using CSS3 styles when converting HTML to PDF, giving you control over individual text orientation. 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: 14,631,247 View Licenses