HTML Rendering Settings

IronPDF for Python exposes a rich set of rendering options through the ChromePdfRenderer.RenderingOptions property, giving you precise control over every aspect of the generated PDF.

Getting Started

Instantiate a ChromePdfRenderer, adjust the properties on its RenderingOptions object, and then call one of the render methods. Every option you set is applied to all PDFs produced by that renderer instance.

Understanding the Code

  • SetCustomPaperSizeInInches: Defines a non-standard page width and height in inches.
  • PrintHtmlBackgrounds: When True, CSS background colors and images are included in the output.
  • PaperOrientation: Accepts PdfPaperOrientation.Landscape or Portrait.
  • Title: Sets the internal document title visible in PDF metadata.
  • EnableJavaScript: Allows inline <script> blocks and external scripts to execute before the PDF is rendered.
  • WaitFor.RenderDelay: Pauses rendering for a specified number of milliseconds, useful when JavaScript needs time to complete.
  • CssMediaType: Switch between Screen and Print CSS rules to control which stylesheet is applied.
  • FitToPaperMode: Controls how content is scaled to fit the page (e.g., Zoom, AutomaticFit).
  • Zoom: Percentage zoom level applied to the page content.
  • CreatePdfFormsFromHtml: When True, HTML <input> and <select> elements are converted to interactive PDF form fields.
  • MarginTop / MarginLeft / MarginRight / MarginBottom: Set page margins in millimeters.
  • FirstPageNumber: Starting page number, useful when a cover page will be prepended to the document.

Applying Options

All options are set before calling a render method such as RenderUrlAsPdf, RenderHtmlAsPdf, or RenderHtmlFileAsPdf. The renderer can be reused across multiple render calls with the same settings.

Learn to Convert HTML to PDF with IronPDF for Python!

Ready to Get Started?
Version: 2026.6 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast?
run a sample watch your HTML become a PDF.