Class ChromeClient<T>
Chrome client implementation which uses interop to satisfy functionality using native code
ChromeClient utilize IronSoftware.JobQueue.JobQueueManager to queue requests to the native code
Inheritance
System.Object
ChromeClient<T>
Implements
System.IDisposable
Assembly: IronPdf.dll
Syntax
public class ChromeClient<T> : Object where T : ChromeDeploymentBase
Type Parameters
Rendering HTML, URIs, files, ZIP archives, and images into PDF documents is the central job of ChromeClient<T>, the native-interop handle that bridges managed C# code to IronPDF's Chromium rendering engine. Every render call is queued through an internal job manager so that concurrent requests are serialized safely without blocking the calling thread longer than necessary.
Construct the client by passing an IPdfClient to ChromeClient(IPdfClient pdfClient). From that point the client exposes five distinct rendering paths, plus annotation, stamping, cookie management, and measurement utilities. The generic constraint where T : ChromeDeploymentBase lets the runtime select the correct native deployment without any additional configuration from the caller.
**Rendering paths**
- RenderPDFFromHTML: converts an HTML string with a base Uri, optional proxy, ChromePdfRenderOptions, and ChromeHttpLoginCredentials into a document ID and a metadata string. - RenderPDFFromURI: fetches and renders a live URL, accepting ChromePdfRenderOptions and ChromeHttpLoginCredentials. - RenderPDFFromFile: renders a local file path, returning the same (IDocumentId, string) tuple. - RenderPDFFromZIP: accepts a ZIP archive as a byte[] together with the name of the entry point file, useful for self-contained HTML bundles with embedded assets. - RenderPDFFromImages: converts a list of image paths or raw (byte[], string) pairs into a PDF, with ImageBehavior controlling layout.
**Post-render operations**
- AddHtmlHeadersAndFooters: stamps HTML-based headers and footers onto specified pages, respecting owner and user passwords. - AddStamp / AddStamps: applies one or multiple Stamper objects to a set of IPdfPage instances. - MeasureHTML: returns a Size for an HTML fragment without producing a PDF, useful for layout pre-checks.
**Session utilities**
- ApplyCookies: associates a Dictionary<string, string> of cookies with a URL before a render call. - ClearCookies: removes all cookies from the current session. - ExtractImagesFromMultiFrameImageFormats: a static helper that expands multi-frame image files (such as animated GIFs or multi-page TIFFs) into individual frame paths before passing them to RenderPDFFromImages.
Call Dispose when the client is no longer needed; the protected Finalize override provides a safety net, but explicit disposal is preferred.
using IronPdf.Engines.Chrome;
using IronPdf.Rendering;
// Obtain an IPdfClient from the IronPDF infrastructure, then:
using var client = new ChromeClient<ChromeDeploymentBase>(pdfClient);
var renderOptions = new ChromePdfRenderOptions { MarginTop = 10 };
var credentials = new ChromeHttpLoginCredentials();
var (docId, meta) = client.RenderPDFFromHTML(
"<h1>Hello, IronPDF</h1>",
baseUrl: new Uri("https://example.com"),
proxy: null,
renderOptions,
credentials);
Console.WriteLine($"Document ID: {docId} | Meta: {meta}");
For broader context on PDF generation options, see the IronPDF documentation hub, the HTML-to-PDF how-to, the stamping how-to, and the getting-started guide.
Constructors
ChromeClient(IPdfClient)
Create a new local chrome client
Declaration
public ChromeClient(IPdfClient pdfClient)
Parameters
| Type |
Name |
Description |
| IronSoftware.Pdfium.IPdfClient |
pdfClient |
|
Methods
Declaration
public void AddHtmlHeadersAndFooters(IDocumentId id, string owner_password, string user_password, ChromePdfRenderOptions Options, List<int> pages, string url, string htmlTitle, string pdfTitle)
Parameters
| Type |
Name |
Description |
| IronSoftware.Abstractions.Pdf.IDocumentId |
id |
|
| System.String |
owner_password |
|
| System.String |
user_password |
|
| ChromePdfRenderOptions |
Options |
|
| System.Collections.Generic.List<System.Int32> |
pages |
|
| System.String |
url |
|
| System.String |
htmlTitle |
|
| System.String |
pdfTitle |
|
AddStamp(IDocumentId, String, String, Stamper, IEnumerable<IPdfPage>)
Declaration
public void AddStamp(IDocumentId id, string owner_password, string user_password, Stamper Stamper, IEnumerable<IPdfPage> pages)
Parameters
| Type |
Name |
Description |
| IronSoftware.Abstractions.Pdf.IDocumentId |
id |
|
| System.String |
owner_password |
|
| System.String |
user_password |
|
| Stamper |
Stamper |
|
| System.Collections.Generic.IEnumerable<IPdfPage> |
pages |
|
AddStamps(IDocumentId, String, String, IEnumerable<Stamper>, IEnumerable<IPdfPage>)
Declaration
public void AddStamps(IDocumentId id, string owner_password, string user_password, IEnumerable<Stamper> Stampers, IEnumerable<IPdfPage> pages)
Parameters
| Type |
Name |
Description |
| IronSoftware.Abstractions.Pdf.IDocumentId |
id |
|
| System.String |
owner_password |
|
| System.String |
user_password |
|
| System.Collections.Generic.IEnumerable<Stamper> |
Stampers |
|
| System.Collections.Generic.IEnumerable<IPdfPage> |
pages |
|
ApplyCookies(String, Dictionary<String, String>)
Declaration
public void ApplyCookies(string url, Dictionary<string, string> cookies)
Parameters
| Type |
Name |
Description |
| System.String |
url |
|
| System.Collections.Generic.Dictionary<System.String, System.String> |
cookies |
|
ClearCookies()
Declaration
public void ClearCookies()
Dispose()
Declaration
public virtual void Dispose()
Declaration
public static (List<string>, List<string>) ExtractImagesFromMultiFrameImageFormats(List<string> imagePathList)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.List<System.String> |
imagePathList |
|
Returns
| Type |
Description |
| System.ValueTuple<System.Collections.Generic.List<System.String>, System.Collections.Generic.List<System.String>> |
|
Finalize()
Declaration
protected override void Finalize()
Initialize()
Declaration
protected virtual void Initialize()
MeasureHTML(String, Uri, String, ChromePdfRenderOptions)
Measure the size of an HTML fragment.
Declaration
public Size MeasureHTML(string html, Uri baseUrl, string proxy, ChromePdfRenderOptions renderOptions)
Parameters
| Type |
Name |
Description |
| System.String |
html |
The HTML fragment to measure.
|
| System.Uri |
baseUrl |
Optional: a base URL.
|
| System.String |
proxy |
Optional: a proxy.
|
| ChromePdfRenderOptions |
renderOptions |
Render options to use when rendering the HTML fragment.
|
Returns
| Type |
Description |
| SixLabors.ImageSharp.Size |
The size of the HTML fragment.
|
RenderPDFFromFile(ChromePdfRenderOptions, ChromeHttpLoginCredentials, String)
Declaration
public (IDocumentId, string) RenderPDFFromFile(ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials, string filePath)
Parameters
Returns
| Type |
Description |
| System.ValueTuple<IronSoftware.Abstractions.Pdf.IDocumentId, System.String> |
|
RenderPDFFromHTML(String, Uri, String, ChromePdfRenderOptions, ChromeHttpLoginCredentials)
Declaration
public (IDocumentId, string) RenderPDFFromHTML(string html, Uri baseUrl, string proxy, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)
Parameters
Returns
| Type |
Description |
| System.ValueTuple<IronSoftware.Abstractions.Pdf.IDocumentId, System.String> |
|
RenderPDFFromImages(List<String>, IEnumerable<(Byte[], String)>, ImageBehavior, ChromePdfRenderOptions)
Declaration
public IDocumentId RenderPDFFromImages(List<string> imagePathList, IEnumerable<(byte[], string)> images, ImageBehavior behavior, ChromePdfRenderOptions RenderingOptions)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.List<System.String> |
imagePathList |
|
| System.Collections.Generic.IEnumerable<System.ValueTuple<System.Byte[], System.String>> |
images |
|
| ImageBehavior |
behavior |
|
| ChromePdfRenderOptions |
RenderingOptions |
|
Returns
| Type |
Description |
| IronSoftware.Abstractions.Pdf.IDocumentId |
|
RenderPDFFromURI(Uri, ChromePdfRenderOptions, ChromeHttpLoginCredentials)
Declaration
public IDocumentId RenderPDFFromURI(Uri url, ChromePdfRenderOptions RenderingOptions, ChromeHttpLoginCredentials LoginCredentials)
Parameters
Returns
| Type |
Description |
| IronSoftware.Abstractions.Pdf.IDocumentId |
|
RenderPDFFromZIP(in Byte[], String, ChromePdfRenderOptions, ChromeHttpLoginCredentials)
Declaration
public (IDocumentId, string) RenderPDFFromZIP(in byte[] bytes, string mainFile, ChromePdfRenderOptions RenderingOptions, ChromeHttpLoginCredentials LoginCredentials)
Parameters
Returns
| Type |
Description |
| System.ValueTuple<IronSoftware.Abstractions.Pdf.IDocumentId, System.String> |
|
Implements
System.IDisposable