Portrait & Landscape Orientation Often, when you're creating dynamic PDF documents, you'll find yourself needing to customize the orientation of the document. This is where IronPDF's PaperOrientation comes in. This tool allows developers to access the PdfPaperOrientation class. With this, you can choose between landscape or portrait page orientation when rendering PDF documents from HTML or URL content. For Landscape orientation, you would use: PdfPaperOrientation.Landscape For Portrait orientation, you use: PdfPaperOrientation.Portrait If you are working with existing PDF documents, you can use the PageRotation to customize the orientation of the PDF document. To set the rotation of the pages within your document, you would: Use SetPageRotation when you're looking to rotate a specific page within the PDF Use SetAllPageRotations if you want to rotate all of the pages within your PDF document 5 Steps for Setting PDF Page Orientation var renderer = new ChromePdfRenderer(); renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Landscape; var newPdfFromHtml = renderer.RenderHtmlAsPdf("<h1> Hello World! </h1>"); var existingPdf = new PdfDocument("old_report.pdf"); existingPdf.SetPageRotation(0, PdfPageRotation.Clockwise90); To start with, we will first need to decide whether we are using an existing PDF document, or rendering a new one. First, let's look at the steps for setting the orientation of a newly rendered PDF document, and then how it works for an existing PDF. First, you'll need to create a new ChromePdfRenderer() instance. This will handle the creation of a new PDF document from HTML or URL content. Next, before rendering, the paper orientation is set using renderer.RenderingOptions.PaperOrientation. By choosing PdfPaperOrientation.Landscape, the generated PDF will appear in landscape mode instead of the default portrait orientation. We'll use the rendering method RenderHtmlAsPdf, which takes an HTML string and instantly converts it into a PDF. Now, let's take a look at how you can set a custom orientation for existing PDF documents. First, we'll load a file named old_report.pdf into a PdfDocument object, giving access to its pages. Using Pages[0].PageRotation, you can check the rotation state of the first page. To make changes, SetPageRotation rotates a single page, in this case turning page one by 90 degrees clockwise. Together, these examples illustrate how IronPDF not only creates polished PDFs from HTML and web sources but also provides powerful tools to adjust page orientation and rotation in existing PDF documents, streamlining PDF workflows for .NET developers. Learn More About Page Orientation & Rotation in PDFs. View on GitHub Code https://github.com/iron-software/IronPdf.Examples/tree/main/examples/pdf-page-orientation Download ZIP Related Tutorial Related How-To Guide Class Documentation Get Language Packs Download IronPDF DLL Report an Issue on this page Ready to Get Started? Nuget Downloads 16,227,205 | Version: 2025.11 just released Free NuGet Download Total downloads: 16,227,205 View Licenses
All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)