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:
For Portrait use:
- 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
PageRotationofNone. - The value of
PageRotationdoes NOT have any effect on thewidthandheightof the page. - Specifying a
PageRotationofNoneon a210mm x 297mmpage will result in a page withwidth=210 height=297. - Specifying a
PageRotationofClockwise90on a210mm x 297mmpage will result in a page withwidth=210 height=297.



