IRONSOFTWAREHOME
HTML Rendering Settings
from ironpdf import *

# Instantiate Renderer
renderer = ChromePdfRenderer()

# Many rendering options to use to customize!
renderer.RenderingOptions.SetCustomPaperSizeInInches(12.5, 20)
renderer.RenderingOptions.PrintHtmlBackgrounds = True
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape
renderer.RenderingOptions.Title = "My PDF Document Name"
renderer.RenderingOptions.EnableJavaScript = True
renderer.RenderingOptions.WaitFor.RenderDelay(50) # in milliseconds
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Screen
renderer.RenderingOptions.FitToPaperMode = FitToPaperModes.Zoom
renderer.RenderingOptions.Zoom = 100
renderer.RenderingOptions.CreatePdfFormsFromHtml = True
 
# Supports margin customization!
renderer.RenderingOptions.MarginTop = 40 # millimeters
renderer.RenderingOptions.MarginLeft = 20 # millimeters
renderer.RenderingOptions.MarginRight = 20 # millimeters
renderer.RenderingOptions.MarginBottom = 40 # millimeters
 
# Can set FirstPageNumber if you have a cover page
renderer.RenderingOptions.FirstPageNumber = 1 # use 2 if a cover page will be appended
 
# Settings have been set, we can render:
renderer.RenderUrlAsPdf("https://www.wikipedia.org/").SaveAs("my-content.pdf")
pip install ironpdf
HTML Rendering Settings

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.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.

OR
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 Iron Suite
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
Python Module Download for PDF
Install with pip

Version: 2026.9

  1. Download and install Python 3.7+.
  2. Install pip from pypi.org if it isn't installed already.
  3. Execute the above command in the terminal.
Python PDF Module
Download Module

Version: 2026.9

Manually install into your project

  1. Download the package
  2. Run this command from the terminal
    pip install ironpdf-2026.9-py37-none-win_amd64.whi

Licenses from $999