Skip to footer content

How to Rotate Text in PDFs Using C#

Unlock the power of seamless PDF customization by watching this tutorial, where you'll master rotating text and pages using IronPDF, ensuring your documents are both dynamic and professionally tailored.

In this tutorial, we explore how to rotate text and pages in PDF documents using IronPDF in .NET. We begin by ensuring the IronPDF NuGet package is installed. Next, we move to the Program.cs file, where we import IronPDF and set up the license key. We instantiate the ChromePdfRenderer object for creating and manipulating PDFs. Setting the input encoding to UTF-8 ensures proper HTML content rendering. We use the transform CSS property to rotate text within an HTML string, saving the output as 'rotated-text.pdf'. To rotate existing PDF pages, we open the document using the PdfDocument.FromFile method and rotate the first page 90° clockwise with the SetPageRotation method, saving the result as 'rotated-page.pdf'. For rotating all pages, we use the SetAllPageRotations method, rotating 180° clockwise, saving it as 'rotated-pages.pdf'. Running the project confirms successful rotation, providing enhanced document customization. This tutorial offers a comprehensive guide to rotating text and pages in PDFs, enhancing control over document appearance.

Related Videos