Responsive HTML to PDF
Rendering an HTML page into a PDF is pretty straightforward and easy to do. However, when the page is responsive, we have to be more careful and the page can change with time and page navigation. IronPDF can render responsive HTML into PDF documents.
In this example, we will show you how to render a responsive HTLM page into a PDF.
By using the
ViewPortWidthproperties of the
PdfRenderingOptions class, you can specify the size of the virtual Chrome window, which will render your responsive HTML.
This allows developers to programmatically choose a specific responsive layout of a webpage designed using responsive CSS3, and supports modern responsive HTML5 frameworks such as Bootstrap.
IronPdf.ChromePdfRendererallows any web page or HTML snippet to be turned into a PDF document using an up-to-date embedded Chrome browser.
As of 2021, Iron Software recommends
ChromePdfRenderer as our best PDF Renderer and a drop-in replacement for this class. You can also apply cookies from the specified login credentials class to the specified URL, create a PDF file from an HTML string, and return it as a
PdfDocument object which can be edited and saved to disk or served on a website.