from ironpdf import *
# For NEW PDF Documents use PdfPaperOrientation
# PdfPaperOrientation: To choose Landscape or Portrait Orientation in a new PDF document
renderer = ChromePdfRenderer()
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape
new_pdf_from_html = renderer.RenderHtmlAsPdf("<h1> Hello World! </h1>")
new_pdf_from_html_file = renderer.RenderHtmlFileAsPdf("example.html")
new_pdf_from_url = renderer.RenderUrlAsPdf("https://ironpdf.com")
# For EXISTING PDFs use PageRotation
# PageRotation: To rotate a PDF page and all of its contents
existing_pdf = PdfDocument.FromFile("old_report.pdf")
# Get rotation value
get_rotation_first_page = existing_pdf.Pages[0].PageRotation
# Rotate specified page
existing_pdf.SetPageRotation(PageIndex=0, Rotation=PdfPageRotation.Clockwise90)
# Rotate ALL pages
existing_pdf.SetAllPageRotations(PdfPageRotation.Clockwise270)
#For NEW PDF Documents use PdfPaperOrientation
#PdfPaperOrientation: To choose Landscape or Portrait Orientation in a new PDF document
#For EXISTING PDFs use PageRotation
#PageRotation: To rotate a PDF page and all of its contents
#Get rotation value
#Rotate specified page
#Rotate ALL pages
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'from ironpdf import * renderer = ChromePdfRenderer() renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape new_pdf_from_html = renderer.RenderHtmlAsPdf("<h1> Hello World! </h1>") new_pdf_from_html_file = renderer.RenderHtmlFileAsPdf("example.html") new_pdf_from_url = renderer.RenderUrlAsPdf("https://ironpdf.com") existing_pdf = PdfDocument.FromFile("old_report.pdf") get_rotation_first_page = existing_pdf.Pages[0].PageRotation existing_pdf.SetPageRotation(PageIndex=0, Rotation=PdfPageRotation.Clockwise90) existing_pdf.SetAllPageRotations(PdfPageRotation.Clockwise270)