IRONSOFTWAREHOME
Responsive HTML to PDF
using IronPdf;
using IronPdf.Engines.Chrome;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

// Set the width of the Responsive Viewport in pixels
int pixelWidth = 1280;
renderer.RenderingOptions.PaperFit.UseResponsiveCssRendering(pixelWidth);

// Set paper mode to automatic fit to physical paper
renderer.RenderingOptions.FitToPaperMode = FitToPaperModes.AutomaticFit;

// Render an HTML file
var pdf = renderer.RenderHtmlFileAsPdf("Assets/Responsive.html");
Imports IronPdf
Imports IronPdf.Engines.Chrome

' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()

' Set the width of the Responsive Viewport in pixels
Dim pixelWidth As Integer = 1280
renderer.RenderingOptions.PaperFit.UseResponsiveCssRendering(pixelWidth)

' Set paper mode to automatic fit to physical paper
renderer.RenderingOptions.FitToPaperMode = FitToPaperModes.AutomaticFit

' Render an HTML file
Dim pdf = renderer.RenderHtmlFileAsPdf("Assets/Responsive.html")
NuGet Download
PM > Install-Package IronPdf
Responsive HTML to PDF

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 HTML page into a PDF.

By using the UseResponsiveCssRendering function of the PaperFit property 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.

ChromePdfRenderer allows 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. For further details on how to utilize the ChromePdfRenderer, visit the IronPDF product page.

Learn Responsive HTML to PDF Conversion Now.
View on GitHub

Ready to Get Started?

Nuget Downloads 20,878,335Version: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.

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