IRONSOFTWAREHOME
Portrait & Landscape Orientation
using IronPdf;

// For NEW PDF Documents use PdfPaperOrientation
// PdfPaperOrientation: To choose Landscape or Portrait Orientation in a new PDF document
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Landscape;

var newPdfFromHtml = renderer.RenderHtmlAsPdf("<h1> Hello World! </h1>");
var newPdfFromHtmlFile = renderer.RenderHtmlFileAsPdf("example.html");
var newPdfFromUrl = renderer.RenderUrlAsPdf("https://ironpdf.com");


// For EXISTING PDFs use PageRotation
// PageRotation : To rotate a PDF page and all of its  its contents
var existingPdf = new PdfDocument("old_report.pdf");

// Get rotation value
var getRotationFirstPage = existingPdf.Pages[0].PageRotation;

// Rotate specified page
existingPdf.SetPageRotation(PageIndex: 0, Rotation: IronPdf.Rendering.PdfPageRotation.Clockwise90);

// Rotate ALL pages
existingPdf.SetAllPageRotations(IronPdf.Rendering.PdfPageRotation.Clockwise270);
Imports IronPdf

' For NEW PDF Documents use PdfPaperOrientation
' PdfPaperOrientation: To choose Landscape or Portrait Orientation in a new PDF document
Dim renderer = New ChromePdfRenderer()
renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Landscape

Dim newPdfFromHtml = renderer.RenderHtmlAsPdf("<h1> Hello World! </h1>")
Dim newPdfFromHtmlFile = renderer.RenderHtmlFileAsPdf("example.html")
Dim newPdfFromUrl = renderer.RenderUrlAsPdf("https://ironpdf.com")


' For EXISTING PDFs use PageRotation
' PageRotation : To rotate a PDF page and all of its  its contents
Dim existingPdf = New PdfDocument("old_report.pdf")

' Get rotation value
Dim getRotationFirstPage = existingPdf.Pages(0).PageRotation

' Rotate specified page
existingPdf.SetPageRotation(PageIndex:=0, Rotation:=IronPdf.Rendering.PdfPageRotation.Clockwise90)

' Rotate ALL pages
existingPdf.SetAllPageRotations(IronPdf.Rendering.PdfPageRotation.Clockwise270)
NuGet Download
PM > Install-Package IronPdf
Portrait & Landscape Orientation

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

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

Ready to Get Started?

Nuget Downloads 20,878,335Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required