Portrait & Landscape Orientation

When creating or rendering your PDF in IronPDF, you can choose from one of two orientations of how you want your document to be. The PdfPaperOrientation class determines the paper orientation when rendering HTML to PDF with IronPDF.

This example shows you how to set a paper orientation for your documents.

IronPDF has two different values in PDFs called PaperOrientation and PageRotation. Both are used differently. Not only that, you need to know when to use which.

PdfPaperOrientation - This is for NEW PDF Documents rendered from HTML or URL:

  • This is only valid as a setting when rendering a document from HTML or from a URL.
  • For Landscape use: renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
  • For Portrait use: renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Portrait;
  • However, the information is then LOST after the document is rendered.

PageRotation - This is used for already existing PDF Documents:

  • This is only valid as a property of an existing document. (Meaning this cannot be specified during rendering of a new document).
  • This information is stored as part of the document itself. On a per-page basis.
  • Pages of newly rendered documents will always have a default PageRotation of None.
  • The value of PageRotation does NOT have any effect on the width and height of the page.
  • Specifying a PageRotation of None on a 210mm x 297mm page will result in a page with width=210 height=297
  • Specifying a PageRotation of Clockwise90 on a 210mm x 297mm page will result in a page with width=210 height=297