IronPDF Chrome Renderer

Why update to the IronPDF Chrome rendering engine?

A 'Chrome Identical' renderer has so far been the primary upgrade to IronPDF in 2021.

Here is what to expect:

Good Reasons to Use the Updated Library:

  • The latest “Blink!” HTML rendering! Choose from Chrome Identical rendering or Enhanced rendering - We find this to be more accurate and easier to code for than Chrome.
  • Speed. 20% faster renders, providing effortless multithreading and Async, using as many CPU cores as you wish. For SAAS and high-load application this may be 5-20 times faster: outperforming direct browser usage and web-drivers.
  • Full (and we mean full) JavaScriptResponsive layout and CSS3 support.
  • Section 508 accessibility compliance. Producing accessible PDFs using the PDF(UA) tagged PDF standard.
  • Azure as a first class citizen. It just works.
  • We tested the hell out of it. 1156 green unit & integration tests (no red ones).
  • Maintained and improved full support for: .Net 5, Core and Framework 4.0+ support.

 
We'd love to your feedback - contact developers@ironsoftware.com with your ideas or if you need help getting things running.

Let's Get Coding:

The one thing you can’t forget to do:

First you need to do is: update the package inside your project in Nuget Package Manager

PM> Install-Package IronPdf

Move to the latest Chrome renderer in 1 line of code

Change to the new renderer at a global level is simple. This approach updates all usages of your existing  HtmlToPdf and AspxToPdf code.
Just do this once, before you render any PDFs and you have switched to the new renderer.

IronPdf.Installation.DefaultRenderingEngine = IronPdf.Rendering.PdfRenderingEngine.Chrome;

Try out the new API

We haven’t broken the IronPDF C# and VB.NET API you are already using, it will remain! However, the old style is being superseded by a better one to give you more control. For examples you now have RenderingOptions and HttpLoginCredentials specific to your renderer.

using IronPdf;
ChromePdfRenderer Renderer = new ChromePdfRenderer();
Renderer.RenderingOptions.FitToPaper = true;
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Screen;
Renderer.RenderingOptions.PrintHtmlBackgrounds = true;
Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
using var doc = Renderer.RenderHtmlAsPdf("<h1>Hello world!</h1>");
// var doc = Renderer.RenderUrlAsPdf("https://www.google.com/");
// var doc = Renderer.RenderHtmlFileAsPdf("example.html");
doc.SaveAs("google_chrome.pdf");

Pixel perfect Chrome rendering ?

This example will give you PDFs which is pixel perfect to the latest Chrome desktop browsers “print to PDF” functionality:

ChromePdfRenderer Renderer = new ChromePdfRenderer();
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
Renderer.RenderingOptions.PrintHtmlBackgrounds = false;
Renderer.RenderingOptions.CreatePdfFormsFromHtml = false;
using var doc = Renderer.RenderUrlAsPdf("https://www.google.com/");

However...we would recommend using some Iron specific improvements such as:

  • Using screen stylesheets to print PDFs which are less fiddly to develop and more true to existing web assets.
  • Responsive layout support.
  • Creating PDF Forms from your HTML form elements.
ChromePdfRenderer Renderer = new ChromePdfRenderer();
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Screen;
Renderer.RenderingOptions.PrintHtmlBackgrounds = true; Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
Renderer.RenderingOptions.ViewportWidth = 1080; //pixels
using var doc = Renderer.RenderUrlAsPdf("https://www.google.com/");

Comparing Chrome and WebKit 
You can use the IronPdf.Rendering.AdaptivePdfRenderer to switch between the ‘Chrome’ and ‘WebKit’ rendering at an instance level if you preferred the old rendering style for some of your application, or don't want to break unit tests.

using IronPdf;
IronPdf.Rendering.AdaptivePdfRenderer Renderer = new IronPdf.Rendering.AdaptivePdfRenderer();
Renderer.RenderingOptions.RenderingEngine = IronPdf.Rendering.PdfRenderingEngine.Chrome;
/*switch between Chrome and WebKit here*/
using var doc = Renderer.RenderHtmlAsPdf("<h1>Hello world!</h1>");

Use every CPU core available!

Multithreading and Async support for our Chrome rendering engine is in a different league to the previous build.

  • For enterprise grade multi-threading use our ChromePdfRenderer in your existing threads and it will work. For web applications this also takes zero setup.
  • For batch processing of HTML to PDF we recommend using the built in .NET Parallel.ForEach pattern.
  • We love async and have provided Async variants of all of our rendering methods methods such as ChromePdfRenderer.RenderHtmlAsPdfAsync

What is next?

Coming Soon:

  • Mobile rendering support: support for iOS and Android app developers.
  • IE and Firefox rendering options.
  • Multi-server distributed rendering architectures for large enterprise users.
  • "{YourIdeaHere}" Feature requests and bug reports from our customers go to the top of the stack.