Search Results for

    Show / Hide Table of Contents

    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
    Namespace: IronPdf.Engines.Chrome
    Assembly: IronPdf.dll
    Syntax
    public class ChromeClient<T> : Object where T : ChromeDeploymentBase
    Type Parameters
    Name Description
    T

    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

    AddHtmlHeadersAndFooters(IDocumentId, String, String, ChromePdfRenderOptions, List<Int32>, String, String, String)

    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()

    ExtractImagesFromMultiFrameImageFormats(List<String>)

    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
    Type Name Description
    ChromePdfRenderOptions renderOptions
    ChromeHttpLoginCredentials loginCredentials
    System.String filePath
    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
    Type Name Description
    System.String html
    System.Uri baseUrl
    System.String proxy
    ChromePdfRenderOptions renderOptions
    ChromeHttpLoginCredentials loginCredentials
    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
    Type Name Description
    System.Uri url
    ChromePdfRenderOptions RenderingOptions
    ChromeHttpLoginCredentials LoginCredentials
    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
    Type Name Description
    System.Byte[] bytes
    System.String mainFile
    ChromePdfRenderOptions RenderingOptions
    ChromeHttpLoginCredentials LoginCredentials
    Returns
    Type Description
    System.ValueTuple<IronSoftware.Abstractions.Pdf.IDocumentId, System.String>

    Implements

    System.IDisposable
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    IronPDF_for_dotnet_log2o
    Blue key in circleGet started for FREE
    No credit card required
    Test in a live environment

    Test in production without watermarks.
    Works wherever you need it to.

    Fully-functional product

    Get 30 days of fully functional product.
    Have it up and running in minutes.

    24/5 technical support

    Full access to our support engineering team during your product trial

    Grey key in circleGet started for FREE
    The trial form was submitted successfully.
    Calendar in circleBook Free Live Demo
    No contact, no card details, no commitments Book a 30-minute, personal demo.
    Here's what to expect:

    A live demo of our product and its key features

    Get project specific feature recommendations

    All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation
    Support Team Member 6 related to The C# PDF Library Support Team Member 14 related to The C# PDF Library Support Team Member 4 related to The C# PDF Library Support Team Member 2 related to The C# PDF Library
    Online 24/5
    Need help? Our sales team would be glad to help you.
    Try the Enterprise Trial
    ironpdf_for_dotnet_log2o
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    bullet_checkedNo credit card or account creation required
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    Blue key in circleNo credit card or account creation required
    Green Check in orange circle
    The trial form was submitted successfully.
    badge_greencheck_in_yellowcircle
    Thank you for starting a trial

    Please check your email for the trial license key.

    If you don’t receive an email, please start a live chat or email support@ironsoftware.com

    Install with NuGet
    View Licensing
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronPDF