HTML to PDF
This code example illustrates IronPDF for Python's flagship HTML to PDF conversion capability.
Python developers can use the
RenderHtmlAsPdf method to convert raw HTML markup into PDF documents. IronPDF can render all HTML content faithfully into its equivalent PDF form. This includes this simple "Hello World" example featured above and also more complex HTML structures consisting of nested elements.
As shown above, the
RenderHtmlAsPdf method accepts a string containing the HTML markup to be rendered into a PDF. Note that the method also recognizes images, iframes, and other externally-referenced assets included in the HTML string. Such elements are rendered in generated PDFs as expected for standards-compliant browsers.
Customize PDF documents generated with the
RenderHtmlAsPdf method with specialized headers, footers, margins, and other page settings. See this code example for more information.