Search Results for

    Show / Hide Table of Contents

    Class ChromePdfRenderer

    Creates professional PDF documents from HTML using the actual Chrome browser engine for pixel-perfect accuracy. Unlike competitors using webkit or custom parsers, IronPDF renders exactly what Chrome's print preview shows.

    Inheritance
    System.Object
    ChromeClientAccessor
    ChromePdfRenderer
    Implements
    IronSoftware.IExtensibleRenderer
    Namespace: IronPdf
    Assembly: IronPdf.dll
    Syntax
    public class ChromePdfRenderer : ChromeClientAccessor, IExtensibleRenderer
    Remarks

    ChromePdfRenderer transforms your HTML, CSS, and JavaScript into PDFs that look exactly as they do in Chrome browser. Perfect for invoices, reports, certificates, and any document that needs consistent professional formatting.

    IronPDF uses a custom-optimized Chrome engine specifically built for PDF generation. Unlike generic Chrome automation tools like Playwright or Puppeteer, our engine: - Renders exactly as displayed on screen (true WYSIWYG) - Provides Section 508 accessibility compliance - Supports PDF/A and PDF/UA standards for archival and accessibility - Includes upcoming PDF 2.0 compliance - Optimized specifically for PDF generation, not general browser automation - Invoice generation: https://ironpdf.com/examples/invoice-pdf/ - Report creation: https://ironpdf.com/examples/report-generation/ - Web archiving: https://ironpdf.com/examples/url-to-pdf/ - Certificate generation: https://ironpdf.com/examples/certificate-pdf/ - Documentation conversion: https://ironpdf.com/examples/markdown-to-pdf/ Single page: ~200ms | Multi-page document: scales linearly | Large documents: use async methods Chrome engine starts once and stays warm for multiple renders - much faster than process-per-PDF solutions. - True Chrome rendering: Not a webkit wrapper or incomplete implementation - Zero dependencies: No need to install Chrome, wkhtmltopdf, or external tools - Cross-platform consistency: Same rendering on Windows, Linux, macOS, Docker, Azure, AWS - JavaScript support: Full V8 engine execution, not just static HTML - Memory efficient: Streaming support for large documents - Assets not loading: Set BaseUrl parameter for relative paths - JavaScript not running: Adjust RenderingOptions.JavascriptDelay - Fonts missing in Docker: Install font packages in container - Memory issues: Always dispose PdfDocument objects when done
    using IronPdf;
    

    // Your first PDF in 2 lines var renderer = new ChromePdfRenderer(); renderer.RenderHtmlAsPdf("

    Hello World

    ").SaveAs("output.pdf");

    using IronPdf;
    
    var renderer = new ChromePdfRenderer();
    renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
    renderer.RenderingOptions.MarginTop = 20;  // millimeters
    
    // For advanced configurations see:
    // https://ironpdf.com/examples/using-html-to-create-a-pdf/
    New to PDF generation? Start with RenderHtmlAsPdf(string) - it's the simplest way to convert HTML to PDF. Just pass your HTML string and save the result. No complex setup required! ChromePdfRenderer is thread-safe for rendering operations. Multiple threads can share a single renderer instance for better performance. Always use 'using' statements with PdfDocument objects: using (var pdf = renderer.RenderHtmlAsPdf(html)) { pdf.SaveAs("file.pdf"); }

    Constructors

    ChromePdfRenderer(IronPdfConnectionConfiguration)

    Creates a new PDF renderer using Chrome's engine for perfect HTML to PDF conversion.

    Declaration
    public ChromePdfRenderer(IronPdfConnectionConfiguration ConnectionConfig = null)
    Parameters
    Type Name Description
    IronPdfConnectionConfiguration ConnectionConfig

    Optional connection configuration for IronPdf services. Leave null for default local rendering.

    Remarks

    Creates a renderer instance that can be reused for multiple PDF generations. The Chrome engine initializes on first use and stays warm for subsequent renders.

    using IronPdf;
    

    // Simple initialization var renderer = new ChromePdfRenderer();

    // Render multiple PDFs efficiently renderer.RenderHtmlAsPdf("

    Invoice 1

    ").SaveAs("invoice1.pdf"); renderer.RenderHtmlAsPdf("

    Invoice 2

    ").SaveAs("invoice2.pdf");

    Properties

    LoginCredentials

    Gets or sets HTTP authentication credentials for accessing protected web resources. Use for basic authentication, custom cookies, or proxy configuration.

    Declaration
    public ChromeHttpLoginCredentials LoginCredentials { get; set; }
    Property Value
    Type Description
    ChromeHttpLoginCredentials

    Credentials for HTTP authentication and proxy settings.

    Examples
    renderer.LoginCredentials.Username = "user";
    renderer.LoginCredentials.Password = "pass";
    See Also
    ChromeHttpLoginCredentials

    RenderingOptions

    Gets or sets the rendering options that control how your PDF looks and behaves. Configure paper size, margins, headers, footers, and JavaScript execution.

    Declaration
    public ChromePdfRenderOptions RenderingOptions { get; set; }
    Property Value
    Type Description
    ChromePdfRenderOptions

    ChromePdfRenderOptions with settings for PDF generation. Defaults to Letter size with 25mm margins.

    Remarks
    - PaperSize: A4 (international) or Letter (US) - CssMediaType: Print (printer-friendly) or Screen (web-like) - JavascriptDelay: Milliseconds to wait for dynamic content - MarginTop/Bottom/Left/Right: In millimeters
    renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
    renderer.RenderingOptions.MarginTop = 10;
    renderer.RenderingOptions.PrintHtmlBackgrounds = true;
    See Also
    ChromePdfRenderOptions

    Methods

    ApplyCookies(String, ChromeHttpLoginCredentials)

    Applies authentication cookies for rendering protected web pages. Use when rendering sites that require login cookies for access.

    // Set cookies from login credentials:
    var renderer = new ChromePdfRenderer();
    var login = new ChromeHttpLoginCredentials();
    login.CustomCookies["sessionId"] = "abc123";
    renderer.ApplyCookies("https://example.com", login);
    var pdf = renderer.RenderUrlAsPdf("https://example.com/protected");
    
    // Alternative: Set directly on render options (preferred):
    renderer.RenderingOptions.CustomCookies["auth"] = "token123";

    Prefer using RenderingOptions.CustomCookies for better control

    URL must match the domain for cookies to apply

    See: https://ironpdf.com/how-to/headers-and-footers/

    Declaration
    public void ApplyCookies(string Url, ChromeHttpLoginCredentials Login)
    Parameters
    Type Name Description
    System.String Url

    URL where cookies will be applied

    ChromeHttpLoginCredentials Login

    Login credentials containing cookies

    ApplyCookies(String, Dictionary<String, String>)

    Applies authentication cookies for rendering protected web pages. Direct dictionary method for setting multiple cookies at once.

    // Apply multiple cookies for authentication:
    var renderer = new ChromePdfRenderer();
    var cookies = new Dictionary<string, string>
    {
        ["sessionId"] = "abc123",
        ["authToken"] = "xyz789",
        ["userId"] = "user456"
    };
    renderer.ApplyCookies("https://app.example.com", cookies);
    var pdf = renderer.RenderUrlAsPdf("https://app.example.com/dashboard");
    
    // Better approach - use RenderingOptions:
    renderer.RenderingOptions.CustomCookies = cookies;
    var pdf = renderer.RenderUrlAsPdf("https://app.example.com");

    Prefer RenderingOptions.CustomCookies for per-render control

    URL must exactly match cookie domain for them to apply

    See: https://ironpdf.com/tutorials/html-to-pdf/

    Declaration
    public void ApplyCookies(string url, Dictionary<string, string> cookies)
    Parameters
    Type Name Description
    System.String url

    URL where cookies will be applied

    System.Collections.Generic.Dictionary<System.String, System.String> cookies

    Dictionary of cookie name-value pairs

    Remarks

    Sets RequestContext to Global for all future renders

    RenderHtmlAsPdf(String, String, String)

    Creates a PDF file from an Html string, and returns it as a PdfDocument.

    IronPDF is a W3C standards compliant HTML rendering based on Google's Chromium browser. If your output PDF does not look as expected:
    - Validate your HTML using https://validator.w3.org/ & CSS https://jigsaw.w3.org/css-validator/
    - To debug HTML, Save your HTML string to a file and view in Chrome web browser's print preview which will work almost exactly as IronPDF.
    - Read our detailed documentation on pixel perfect HTML to PDF: https://ironpdf.com/tutorials/pixel-perfect-html-to-pdf/

    Declaration
    public PdfDocument RenderHtmlAsPdf(string Html, string BaseUrlOrPath, string Proxy = null)
    Parameters
    Type Name Description
    System.String Html

    The Html to be rendered as a PDF.

    System.String BaseUrlOrPath

    Optional. Setting the BaseUBaseUrlOrPathRL property gives the relative file path or URL context for hyper-links, images, CSS and JavaScript files.

    System.String Proxy

    Optional. Specifies an Http proxy server. Use the pattern: http(s)://user-name:password@host:port

    Returns
    Type Description
    PdfDocument

    A PdfDocument

    RenderHtmlAsPdf(String, Uri, String)

    Converts your HTML string into a professional PDF document with full CSS3 and JavaScript support. Perfect for generating invoices, reports, or any document from HTML templates.

    Declaration
    public PdfDocument RenderHtmlAsPdf(string Html, Uri BaseUrl = null, string Proxy = null)
    Parameters
    Type Name Description
    System.String Html

    The HTML content to render. Supports full HTML5, CSS3, and JavaScript.

    System.Uri BaseUrl

    Optional base URL for resolving relative paths to images, CSS, and JavaScript files. Use for local files or remote resources.

    System.String Proxy

    Optional proxy server for external resources. Format: http(s)://user:pass@host:port

    Returns
    Type Description
    PdfDocument

    A PdfDocument ready to save, edit, or serve to users.

    Remarks

    This method handles everything Chrome can render - flexbox, grid, animations, web fonts, and JavaScript. Your PDF will look exactly like Chrome's print preview, ensuring consistency across all platforms.

    Dynamic invoice generation, template-based reports, email-to-PDF conversion, certificate creation Simple HTML: 50-100ms | Complex with images: 200-500ms | JavaScript-heavy: add RenderDelay - Images not showing: Provide BaseUrl for relative paths - CSS not applying: Ensure CSS is inline or BaseUrl points to CSS location - JavaScript not running: Increase RenderingOptions.JavascriptDelay - Fonts missing: Embed fonts or ensure they're installed on the system
    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); var pdf = renderer.RenderHtmlAsPdf("

    Invoice #12345

    Total: $99.99

    "); pdf.SaveAs("invoice.pdf");
    If your images or CSS aren't loading, you probably need to set BaseUrl. For local files: @"C:\MyProject\Assets&quot; or new Uri(@"file:///C:/MyProject/Assets/") For web resources: new Uri("https://mysite.com/assets/")

    Exceptions
    Type Condition
    System.ArgumentNullException

    Html parameter is null or empty.

    System.Net.WebException

    External resources couldn't be loaded. Check network connection and BaseUrl parameter. https://ironpdf.com/how-to/handle-external-resources/

    See Also
    RenderUrlAsPdf(String)
    RenderHtmlFileAsPdf(String)
    HTML String Examples

    RenderHtmlAsPdfAsync(String, Uri)

    Asynchronously converts your HTML string into a professional PDF document with full CSS3 and JavaScript support. Use for non-blocking operations when generating multiple PDFs or in web applications.

    Declaration
    public Task<PdfDocument> RenderHtmlAsPdfAsync(string Html, Uri BaseUrl = null)
    Parameters
    Type Name Description
    System.String Html

    The HTML content to render. Supports full HTML5, CSS3, and JavaScript.

    System.Uri BaseUrl

    Optional base URL for resolving relative paths to images, CSS, and JavaScript files.

    Returns
    Type Description
    System.Threading.Tasks.Task<PdfDocument>

    A Task that resolves to a PdfDocument ready to save or manipulate.

    Remarks

    This is the async version of RenderHtmlAsPdf(String, Uri, String).

    - Use for I/O-bound operations or when processing multiple PDFs - Properly await the returned Task or handle it with ContinueWith - Consider using CancellationToken overloads for long operations - Ideal for web applications to avoid blocking request threads
    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); var pdf = await renderer.RenderHtmlAsPdfAsync("

    Invoice

    "); await pdf.SaveAsAsync("invoice.pdf");

    See Also
    RenderHtmlAsPdf(String, Uri, String)

    RenderHtmlAsPdfForExtension(String)

    Declaration
    public IDocumentId RenderHtmlAsPdfForExtension(string Html)
    Parameters
    Type Name Description
    System.String Html
    Returns
    Type Description
    IronSoftware.IDocumentId

    RenderHtmlAsPdfForExtensionAsync(String)

    Declaration
    public Task<IDocumentId> RenderHtmlAsPdfForExtensionAsync(string Html)
    Parameters
    Type Name Description
    System.String Html
    Returns
    Type Description
    System.Threading.Tasks.Task<IronSoftware.IDocumentId>

    RenderHtmlAsPdfUA(String, NaturalLanguages)

    Creates an accessible PDF/UA document from HTML for screen readers and compliance. Meets ISO 14289-1 standard for universal accessibility and Section 508 requirements.

    // Create accessible PDF for screen readers:
    var renderer = new ChromePdfRenderer();
    var pdf = renderer.RenderHtmlAsPdfUA(
        "

    Annual Report

    Financial summary...

    ", NaturalLanguages.English); pdf.SaveAs("accessible-report.pdf"); // Multi-language accessible document: var html = @"

    Hello

    Hola

    Bonjour

    "; var pdf = renderer.RenderHtmlAsPdfUA(html, NaturalLanguages.English | NaturalLanguages.Spanish | NaturalLanguages.French); // Government compliance document: renderer.RenderingOptions.PdfUA = PdfUACompliance.PDFUA_1; var pdf = renderer.RenderHtmlAsPdfUA(formHtml); pdf.SaveAs("section508-compliant.pdf");

    Essential for government, education, and public sector documents

    HTML should include proper semantic tags for best results

    See: https://ironpdf.com/how-to/pdfua/

    Declaration
    public PdfDocument RenderHtmlAsPdfUA(string Html, NaturalLanguages NaturalLanguages)
    Parameters
    Type Name Description
    System.String Html

    HTML content with proper semantic structure

    NaturalLanguages NaturalLanguages

    Document language(s) for screen reader support

    Returns
    Type Description
    PdfDocument

    A PDF/UA compliant document for universal accessibility

    RenderHtmlFileAsPdf(String)

    Converts a local HTML file into a PDF document, automatically resolving relative paths for CSS, images, and JavaScript. Ideal for converting saved web pages, generated reports, or template files.

    Declaration
    public PdfDocument RenderHtmlFileAsPdf(string FilePath)
    Parameters
    Type Name Description
    System.String FilePath

    Full path to the HTML file to convert (e.g., C:\Reports\invoice.html).

    Returns
    Type Description
    PdfDocument

    A PdfDocument with your HTML file professionally rendered.

    Remarks

    Automatically sets the base path to the file's directory, so relative references to images, CSS, and JavaScript files work without additional configuration.

    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); var pdf = renderer.RenderHtmlFileAsPdf(@"C:\Templates\invoice.html"); pdf.SaveAs("invoice.pdf");

    File path must be absolute, not relative. Use Path.GetFullPath() if needed.

    Exceptions
    Type Condition
    System.IO.FileNotFoundException

    HTML file doesn't exist at the specified path.

    See Also
    HTML File to PDF Guide

    RenderHtmlFileAsPdfAsync(String)

    Asynchronously converts a local HTML file into a PDF document with automatic resource resolution. Perfect for batch processing multiple files without blocking the main thread.

    Declaration
    public Task<PdfDocument> RenderHtmlFileAsPdfAsync(string FilePath)
    Parameters
    Type Name Description
    System.String FilePath

    Full path to the HTML file to convert.

    Returns
    Type Description
    System.Threading.Tasks.Task<PdfDocument>

    A Task that resolves to a PdfDocument with your HTML file rendered.

    Remarks

    This is the async version of RenderHtmlFileAsPdf(String).

    - Ideal for batch processing multiple HTML files - Non-blocking for UI applications - Automatically handles file I/O asynchronously
    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); var pdf = await renderer.RenderHtmlFileAsPdfAsync(@"C:\Templates\report.html"); await pdf.SaveAsAsync("report.pdf");

    See Also
    RenderHtmlFileAsPdf(String)

    RenderHtmlFileAsPdfUA(String, NaturalLanguages)

    Converts an HTML file into an accessible PDF/UA document for screen readers and compliance. Perfect for creating Section 508 and WCAG compliant documents from templates.

    // Convert HTML template to accessible PDF:
    var renderer = new ChromePdfRenderer();
    var pdf = renderer.RenderHtmlFileAsPdfUA(
        "templates/invoice.html",
        NaturalLanguages.English);
    pdf.SaveAs("accessible-invoice.pdf");
    
    // Batch convert documentation to PDF/UA:
    var htmlFiles = Directory.GetFiles("docs", "*.html");
    foreach (var file in htmlFiles)
    {
        var pdf = renderer.RenderHtmlFileAsPdfUA(file);
        pdf.SaveAs(Path.ChangeExtension(file, ".pdf"));
    }
    
    // Multi-language support:
    var pdf = renderer.RenderHtmlFileAsPdfUA(
        "multilingual-form.html",
        NaturalLanguages.English | NaturalLanguages.Spanish);

    Automatically sets proper tags for screen reader navigation

    Use semantic HTML (h1-h6, nav, main, etc.) for best results

    See: https://ironpdf.com/how-to/pdfua/

    Declaration
    public PdfDocument RenderHtmlFileAsPdfUA(string FilePath, NaturalLanguages NaturalLanguages)
    Parameters
    Type Name Description
    System.String FilePath

    Path to the HTML file to convert

    NaturalLanguages NaturalLanguages

    Language(s) for accessibility support

    Returns
    Type Description
    PdfDocument

    A PDF/UA compliant document meeting accessibility standards

    RenderMarkdownFileAsPdf(String)

    Converts a Markdown file (.md) into a beautifully formatted PDF document. Perfect for documentation, README files, technical specs, and content publishing.

    // Convert README to PDF:
    var renderer = new ChromePdfRenderer();
    var pdf = renderer.RenderMarkdownFileAsPdf("README.md");
    pdf.SaveAs("documentation.pdf");
    
    // Convert with custom styling:
    renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print;
    renderer.RenderingOptions.CustomCssUrl = "github-markdown.css";
    var pdf = renderer.RenderMarkdownFileAsPdf("docs/api.md");
    
    // Batch convert documentation:
    var mdFiles = Directory.GetFiles("docs", "*.md", SearchOption.AllDirectories);
    foreach (var mdFile in mdFiles)
    {
        var pdf = renderer.RenderMarkdownFileAsPdf(mdFile);
        pdf.SaveAs(Path.ChangeExtension(mdFile, ".pdf"));
    }

    Supports CommonMark spec with tables, code blocks, and GitHub flavoring

    Custom markdown extensions may not be supported

    See: https://ironpdf.com/examples/markdown-to-pdf/

    Declaration
    public PdfDocument RenderMarkdownFileAsPdf(string FilePath)
    Parameters
    Type Name Description
    System.String FilePath

    Path to the Markdown file to convert

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the Markdown rendered professionally

    RenderMarkdownStringAsPdf(String)

    Converts Markdown content into a beautifully formatted PDF document. Ideal for documentation, README files, technical writing, and content management systems.

    Declaration
    public PdfDocument RenderMarkdownStringAsPdf(string markdownString)
    Parameters
    Type Name Description
    System.String markdownString

    Markdown-formatted text supporting CommonMark specification.

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the Markdown rendered as a professional PDF.

    Remarks

    Converts Markdown to HTML using a CommonMark-compliant parser, then renders with Chrome. Supports headers, lists, links, images, code blocks, tables, and standard Markdown formatting.

    Documentation generation, README to PDF, technical specifications, blog posts to PDF
    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); string markdown = "# Title\n## Subtitle\n- List item\nBold text"; var pdf = renderer.RenderMarkdownStringAsPdf(markdown); pdf.SaveAs("documentation.pdf");

    See Also
    RenderMarkdownFileAsPdf(String)
    Markdown to PDF Examples

    RenderPdfDocumentFromFile(ChromePdfRenderOptions, ChromeHttpLoginCredentials, String)

    Render a PDF document from the specified HTML file path

    Declaration
    public PdfDocument RenderPdfDocumentFromFile(ChromePdfRenderOptions Options, ChromeHttpLoginCredentials Login, string filePath)
    Parameters
    Type Name Description
    ChromePdfRenderOptions Options

    Rendering options

    ChromeHttpLoginCredentials Login

    HTTP login credentials

    System.String filePath

    HTML file path

    Returns
    Type Description
    PdfDocument

    PDF document

    RenderRtfFileAsPdf(String)

    Converts an RTF file (Rich Text Format) into a PDF document preserving formatting and structure. Perfect for converting Word processor documents, legacy reports, and formatted text files.

    // Convert RTF document to PDF:
    var renderer = new ChromePdfRenderer();
    var pdf = renderer.RenderRtfFileAsPdf(@"C:\Documents\report.rtf");
    pdf.SaveAs("report.pdf");
    
    // With custom page settings:
    renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
    renderer.RenderingOptions.MarginTop = 20;
    var pdf = renderer.RenderRtfFileAsPdf("document.rtf");
    
    // Batch convert RTF files:
    foreach (var rtfFile in Directory.GetFiles("docs", "*.rtf"))
    {
        var pdf = renderer.RenderRtfFileAsPdf(rtfFile);
        pdf.SaveAs(Path.ChangeExtension(rtfFile, ".pdf"));
    }

    Preserves tables, formatting, and embedded objects from RTF

    Complex RTF features may have limited support

    See: https://ironpdf.com/how-to/html-file-to-pdf/

    Declaration
    public PdfDocument RenderRtfFileAsPdf(string FilePath)
    Parameters
    Type Name Description
    System.String FilePath

    Path to the RTF file to convert

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the RTF content professionally formatted

    RenderRtfStringAsPdf(String)

    Converts RTF (Rich Text Format) content into a professional PDF document. Perfect for converting Word processor documents, formatted reports, and legacy RTF content.

    Declaration
    public PdfDocument RenderRtfStringAsPdf(string RtfString)
    Parameters
    Type Name Description
    System.String RtfString

    RTF-formatted string containing text, formatting, and embedded objects.

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the RTF content converted to PDF format.

    Remarks

    Internally converts RTF to HTML using IronPDF's RTF parser, then renders with Chrome engine. Preserves text formatting, tables, and basic styling from the RTF source.

    Legacy document conversion, Word processor exports, formatted report generation
    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); string rtf = @"{\rtf1\ansi\b Bold text\b0 and \i italic\i0}"; var pdf = renderer.RenderRtfStringAsPdf(rtf); pdf.SaveAs("document.pdf");

    See Also
    RenderRtfFileAsPdf(String)

    RenderUrlAsPdf(String)

    Converts any website URL into a PDF document, preserving layout, images, and functionality exactly as Chrome displays it. Perfect for archiving web pages, creating documentation, or generating reports from web applications.

    Declaration
    public PdfDocument RenderUrlAsPdf(string UrlOrPath)
    Parameters
    Type Name Description
    System.String UrlOrPath

    The URL to render (https://example.com) or local file path (C:\file.html).

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the web page rendered exactly as it appears in Chrome.

    Remarks

    This method loads the URL in a real Chrome browser, executes JavaScript, loads all resources, and captures the result as a PDF. Authentication, cookies, and dynamic content are fully supported.

    Web page archiving, online report generation, documentation from web apps, website screenshots as PDF Simple pages: 500ms-1s | Complex sites: 2-5s | Use JavascriptDelay for dynamic content Network latency affects performance - consider caching for repeated renders. - Page requires login: Set LoginCredentials or CustomCookies - Dynamic content missing: Increase RenderingOptions.JavascriptDelay - Timeout errors: Increase RenderingOptions.Timeout for slow sites - Behind firewall: Configure Proxy parameter
    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); var pdf = renderer.RenderUrlAsPdf("https://ironpdf.com"); pdf.SaveAs("website.pdf");

    For sites requiring login, use LoginCredentials for basic auth or RenderingOptions.CustomCookies for session-based auth.

    See Also
    RenderHtmlAsPdf(String, Uri, String)
    RenderUrlAsPdfAsync(String)
    URL to PDF Examples

    RenderUrlAsPdf(Uri)

    Creates a PDF file from a URL or local file path and returns it as a PdfDocument.

    Declaration
    public PdfDocument RenderUrlAsPdf(Uri Url)
    Parameters
    Type Name Description
    System.Uri Url

    An absolute (fully formed) Uri. Points to the Html document to be rendered as a PDF.

    Returns
    Type Description
    PdfDocument

    A PdfDocument

    RenderUrlAsPdfAsync(String)

    Asynchronously converts a website URL or file path into a PDF document without blocking. Automatically detects whether the input is a URL or local file path.

    Declaration
    public Task<PdfDocument> RenderUrlAsPdfAsync(string UrlOrPath)
    Parameters
    Type Name Description
    System.String UrlOrPath

    URL (https://example.com) or file path (C:\file.html) to render.

    Returns
    Type Description
    System.Threading.Tasks.Task<PdfDocument>

    A Task that resolves to a PdfDocument ready for saving or manipulation.

    Remarks

    This is the async version of RenderUrlAsPdf(String).

    - Non-blocking for better application responsiveness - Automatically handles both web and file I/O asynchronously - Perfect for processing multiple URLs in parallel
    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); // Works with both URLs and file paths var pdf = await renderer.RenderUrlAsPdfAsync("https://ironpdf.com"); await pdf.SaveAsAsync("output.pdf");

    See Also
    RenderUrlAsPdf(String)

    RenderUrlAsPdfAsync(Uri)

    Asynchronously converts a website URL into a PDF document without blocking your application. Essential for web applications and batch URL processing scenarios.

    Declaration
    public Task<PdfDocument> RenderUrlAsPdfAsync(Uri Url)
    Parameters
    Type Name Description
    System.Uri Url

    An absolute Uri pointing to the web page or local file to render.

    Returns
    Type Description
    System.Threading.Tasks.Task<PdfDocument>

    A Task that resolves to a PdfDocument with the web page captured.

    Remarks

    This is the async version of RenderUrlAsPdf(Uri).

    - Perfect for web applications to avoid blocking request threads - Handles network operations asynchronously - Use with await in async methods or ContinueWith for callbacks
    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); var pdf = await renderer.RenderUrlAsPdfAsync(new Uri("https://ironpdf.com")); await pdf.SaveAsAsync("website.pdf");

    See Also
    RenderUrlAsPdf(Uri)

    RenderZipFileAsPdf(in Byte[], String)

    Converts a ZIP archive byte array containing HTML and assets into a PDF document. Ideal for processing in-memory archives, database BLOBs, or generated ZIP content.

    // Convert ZIP bytes from database:
    byte[] zipData = GetZipFromDatabase(documentId);
    var renderer = new ChromePdfRenderer();
    var pdf = renderer.RenderZipFileAsPdf(zipData, "index.html");
    pdf.SaveAs("document.pdf");
    
    // Process dynamically created ZIP:
    byte[] zipBytes = CreateZipArchive(htmlContent, cssFiles, images);
    var pdf = renderer.RenderZipFileAsPdf(zipBytes, "main.html");
    
    // Convert encrypted ZIP after decryption:
    byte[] decrypted = DecryptZipArchive(encryptedData);
    var pdf = renderer.RenderZipFileAsPdf(decrypted, "report.html");
    pdf.SaveAs("decrypted-report.pdf");

    Efficient for in-memory processing without file I/O

    Large archives may consume significant memory

    See: https://ironpdf.com/how-to/html-zip-file-to-pdf/

    Declaration
    public PdfDocument RenderZipFileAsPdf(in byte[] ZipData, string MainFile)
    Parameters
    Type Name Description
    System.Byte[] ZipData

    Byte array containing the complete ZIP archive

    System.String MainFile

    Name of the primary HTML file within the ZIP

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the ZIP contents rendered

    RenderZipFileAsPdf(Stream, String)

    Converts a ZIP archive stream containing HTML and assets into a PDF document. Perfect for processing uploaded files, in-memory archives, or streamed content.

    // Convert uploaded ZIP file to PDF:
    using (var zipStream = uploadedFile.OpenReadStream())
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderZipFileAsPdf(zipStream, "index.html");
        pdf.SaveAs("uploaded-content.pdf");
    }
    
    // Process ZIP from web API:
    using (var client = new HttpClient())
    using (var stream = await client.GetStreamAsync("https://api.example.com/download.zip"))
    {
        var pdf = renderer.RenderZipFileAsPdf(stream, "report.html");
        pdf.SaveAs("api-report.pdf");
    }

    Stream is read entirely into memory before processing

    Ensure MainFile name matches exactly (case-sensitive)

    See: https://ironpdf.com/how-to/html-zip-file-to-pdf/

    Declaration
    public PdfDocument RenderZipFileAsPdf(Stream ZipStream, string MainFile)
    Parameters
    Type Name Description
    System.IO.Stream ZipStream

    Stream containing the ZIP archive data

    System.String MainFile

    Name of the primary HTML file within the ZIP

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the ZIP contents rendered

    RenderZipFileAsPdf(String, String)

    Converts a ZIP archive containing HTML and assets into a PDF document. Perfect for self-contained web projects, packaged reports, or offline documentation bundles.

    Declaration
    public PdfDocument RenderZipFileAsPdf(string FilePath, string MainFile)
    Parameters
    Type Name Description
    System.String FilePath

    Path to the ZIP file containing HTML and related assets.

    System.String MainFile

    Name of the primary HTML file within the ZIP (e.g., "index.html").

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the ZIP contents rendered as a professional PDF.

    Remarks

    Extracts and renders HTML with all included CSS, JavaScript, images, and fonts from the ZIP. Maintains relative paths between files, ensuring all resources load correctly.

    Offline documentation packages, self-contained web projects, archived websites, report bundles
    using IronPdf;
    

    var renderer = new ChromePdfRenderer(); // ZIP contains index.html, styles.css, images/, etc. var pdf = renderer.RenderZipFileAsPdf("website.zip", "index.html"); pdf.SaveAs("website.pdf");

    • MainFile not found: Ensure the file name matches exactly (case-sensitive)
    • Resources not loading: Check relative paths in HTML match ZIP structure
    See Also
    ZIP to PDF Guide

    StaticRenderHtmlAsPdf(String, ChromePdfRenderOptions, String)

    One-liner PDF generation from HTML. Perfect for quick scripts, console apps, and single-use scenarios. No need to manage renderer lifecycle - just call and go.

    Declaration
    public static PdfDocument StaticRenderHtmlAsPdf(string Html, ChromePdfRenderOptions Options = null, string Proxy = null)
    Parameters
    Type Name Description
    System.String Html

    The HTML content to render as PDF.

    ChromePdfRenderOptions Options

    Optional rendering configuration. Null uses default settings (Letter size, 25mm margins).

    System.String Proxy

    Optional proxy server. Format: http(s)://user:pass@host:port

    Returns
    Type Description
    PdfDocument

    A PdfDocument ready to save or manipulate.

    Remarks

    Why use static methods? Perfect for: - Console applications that generate a single PDF - Unit tests that need quick PDF verification - Scripts and automation tools - Proof of concepts and demos - Any scenario where you just need ONE PDF quickly

    using IronPdf;
    

    // Ultimate one-liner - HTML to PDF to disk ChromePdfRenderer.StaticRenderHtmlAsPdf("

    Invoice

    ").SaveAs("invoice.pdf");

    // Console app example class Program { static void Main(string[] args) { // No renderer to manage, no using statements needed var pdf = ChromePdfRenderer.StaticRenderHtmlAsPdf(args[0]); pdf.SaveAs("output.pdf"); } }

    Static methods are optimized and don't have significant overhead. For bulk operations with shared settings, reusing a renderer instance is slightly more efficient.

    See Also
    RenderHtmlAsPdf(String, Uri, String)

    StaticRenderHtmlAsPdf(String, String, ChromePdfRenderOptions, String)

    Creates a PDF file from an Html string, and returns it as an PdfDocument object which can be edited and saved to disk or served on a website.

    Static version of the RenderHtmlAsPdf method.

    Declaration
    public static PdfDocument StaticRenderHtmlAsPdf(string Html, string BaseUrlOrPath, ChromePdfRenderOptions Options = null, string Proxy = null)
    Parameters
    Type Name Description
    System.String Html

    The Html to be rendered as a PDF.

    System.String BaseUrlOrPath

    Setting the BaseURL property gives the relative context for hyper-links, images, CSS and JavaScript files. May be a remote URL or local file path.

    ChromePdfRenderOptions Options

    An instance of ChromePdfRenderOptions that allows configuration of Chrome "HTML to PDF" rendering parameters.

    System.String Proxy

    Specifies an Http proxy server. Use the pattern: http(s)://user-name:password@host:port

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the Html rendered as its contents.

    StaticRenderHtmlAsPdf(String, Uri, ChromePdfRenderOptions, String)

    Creates a PDF file from an Html string, and returns it as an PdfDocument object which can be edited and saved to disk or served on a website.

    Static version of the RenderHtmlAsPdf method.

    Declaration
    public static PdfDocument StaticRenderHtmlAsPdf(string Html, Uri BaseUrl, ChromePdfRenderOptions Options = null, string Proxy = null)
    Parameters
    Type Name Description
    System.String Html

    The Html to be rendered as a PDF.

    System.Uri BaseUrl

    Setting the BaseURL property gives the relative context for hyper-links, images, CSS and JavaScript files. May be a remote URL or local file path.

    ChromePdfRenderOptions Options

    An instance of ChromePdfRenderOptions that allows configuration of Chrome "HTML to PDF" rendering parameters.

    System.String Proxy

    Specifies an Http proxy server. Use the pattern: http(s)://user-name:password@host:port

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the Html rendered as its contents.

    StaticRenderHtmlAsPdfAsync(String, Uri, ChromePdfRenderOptions)

    Asynchronously renders an HTML string as a PDF. Static version of RenderHtmlAsPdf(String, Uri, String).

    Example:

    var pdf = await ChromePdfRenderer.StaticRenderHtmlAsPdfAsync("<h1>Hello</h1>");
    pdf.SaveAs("output.pdf");

    Declaration
    public static Task<PdfDocument> StaticRenderHtmlAsPdfAsync(string Html, Uri BaseUrl = null, ChromePdfRenderOptions Options = null)
    Parameters
    Type Name Description
    System.String Html

    HTML string to render.

    System.Uri BaseUrl

    Optional base URL for resolving relative paths (default: null).

    ChromePdfRenderOptions Options

    Optional rendering options (default: null uses defaults).

    Returns
    Type Description
    System.Threading.Tasks.Task<PdfDocument>

    A Task containing the rendered PdfDocument.

    StaticRenderHTMLFileAsPdf(String, ChromePdfRenderOptions)

    Renders an HTML file as a PDF file. Returns a PdfDocument object which may be edited and saved to disk or served on a website.

    Static version of the RenderHTMLFileAsPdf method.

    Declaration
    public static PdfDocument StaticRenderHTMLFileAsPdf(string FilePath, ChromePdfRenderOptions Options = null)
    Parameters
    Type Name Description
    System.String FilePath

    Path to an Html file.

    ChromePdfRenderOptions Options

    Optional print options and settings as an instance of ChromePdfRenderOptions.

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the Html file rendered as its contents..

    StaticRenderHTMLFileAsPdfAsync(String, ChromePdfRenderOptions)

    Renders an HTML file as a PDF file. Returns a PdfDocument object which may be edited and saved to disk or served on a website.

    Static Async version of the RenderHTMLFileAsPdf method.

    Declaration
    public static Task<PdfDocument> StaticRenderHTMLFileAsPdfAsync(string FilePath, ChromePdfRenderOptions Options = null)
    Parameters
    Type Name Description
    System.String FilePath

    Path to an Html file.

    ChromePdfRenderOptions Options

    Optional print options and settings as an instance of ChromePdfRenderOptions.

    Returns
    Type Description
    System.Threading.Tasks.Task<PdfDocument>

    A PdfDocument with the Html file rendered as its contents.

    StaticRenderUrlAsPdf(String, ChromePdfRenderOptions)

    Converts a URL to PDF without creating a renderer instance. Quick way to capture web pages. Creates a temporary ChromePdfRenderer internally for convenience.

    Declaration
    public static PdfDocument StaticRenderUrlAsPdf(string UrlOrPath, ChromePdfRenderOptions Options = null)
    Parameters
    Type Name Description
    System.String UrlOrPath

    URL to render (https://example.com) or file path (C:\file.html).

    ChromePdfRenderOptions Options

    Optional rendering configuration. Null uses defaults.

    Returns
    Type Description
    PdfDocument

    A PdfDocument containing the rendered web page.

    Remarks

    Perfect for quick web page captures or one-time conversions. For multiple URLs, create a renderer instance for better performance.

    using IronPdf;
    

    // One-liner web capture ChromePdfRenderer.StaticRenderUrlAsPdf("https://ironpdf.com").SaveAs("website.pdf");

    // With options for dynamic content var options = new ChromePdfRenderOptions { JavascriptDelay = 2000 }; var pdf = ChromePdfRenderer.StaticRenderUrlAsPdf("https://app.example.com", options);

    Static methods are optimized with minimal overhead. Chrome engine is managed efficiently.

    See Also
    RenderUrlAsPdf(String)

    StaticRenderUrlAsPdf(Uri, ChromePdfRenderOptions)

    Renders all Html and assets at a given Url into a PDF file using IronPdf's embedded Chrome browser as the rendering engine.

    Static version of the RenderUrlAsPdf method.

    Declaration
    public static PdfDocument StaticRenderUrlAsPdf(Uri Url, ChromePdfRenderOptions Options = null)
    Parameters
    Type Name Description
    System.Uri Url

    An absolute Uri. Points to the Html document or local file file to be rendered as a PDF.

    ChromePdfRenderOptions Options

    Optional print options and settings as an instance of ChromePdfRenderOptions.

    Returns
    Type Description
    PdfDocument

    A PdfDocument with the Url rendered as its contents.

    StaticRenderUrlAsPdfAsync(String, ChromePdfRenderOptions)

    Renders all Html and assets at a given Url into a PDF file using IronPdf's embedded Chrome browser as the rendering engine.

    Static Async version of the RenderUrlAsPdf method.

    Declaration
    public static Task<PdfDocument> StaticRenderUrlAsPdfAsync(string UrlOrPath, ChromePdfRenderOptions Options = null)
    Parameters
    Type Name Description
    System.String UrlOrPath

    An absolute Url. Points to the Html document or local file to be rendered as a PDF.

    ChromePdfRenderOptions Options

    Optional print options and settings as an instance of ChromePdfRenderOptions.

    Returns
    Type Description
    System.Threading.Tasks.Task<PdfDocument>

    A PdfDocument with the Url rendered as its contents.

    StaticRenderUrlAsPdfAsync(Uri, ChromePdfRenderOptions)

    Renders all Html and assets at a given Url into a PDF file using IronPdf's embedded Chrome browser as the rendering engine.

    Static Async version of the RenderUrlAsPdf method.

    Declaration
    public static Task<PdfDocument> StaticRenderUrlAsPdfAsync(Uri Url, ChromePdfRenderOptions Options = null)
    Parameters
    Type Name Description
    System.Uri Url

    An absolute Uri. Points to the Html document or local file file to be rendered as a PDF.

    ChromePdfRenderOptions Options

    Optional print options and settings as an instance of ChromePdfRenderOptions.

    Returns
    Type Description
    System.Threading.Tasks.Task<PdfDocument>

    A PdfDocument with the Url rendered as its contents.

    StaticRenderZipFileAsPdf(String, String, ChromePdfRenderOptions)

    Creates a PDF file from a local Zip file, and returns it as a PdfDocument.

    IronPDF is a W3C standards compliant HTML rendering based on Google's Chromium browser. If your output PDF does not look as expected:
    - Validate your HTML file using https://validator.w3.org/ & CSS https://jigsaw.w3.org/css-validator/
    - To debug HTML, view the file in Chrome web browser's print preview which will work almost exactly as IronPDF.
    - Read our detailed documentation on pixel perfect HTML to PDF: https://ironpdf.com/tutorials/pixel-perfect-html-to-pdf/

    Declaration
    public static PdfDocument StaticRenderZipFileAsPdf(string FilePath, string MainFile, ChromePdfRenderOptions Options = null)
    Parameters
    Type Name Description
    System.String FilePath

    Path to an Zip to be rendered as a PDF.

    System.String MainFile

    Name of the primary HTML file.

    ChromePdfRenderOptions Options

    Optional print options and settings as an instance of ChromePdfRenderOptions.

    Returns
    Type Description
    PdfDocument

    A PdfDocument

    StaticRenderZipFileAsPdfAsync(String, String, ChromePdfRenderOptions)

    Creates a PDF file from a local Zip file, and returns it as a PdfDocument.

    IronPDF is a W3C standards compliant HTML rendering based on Google's Chromium browser. If your output PDF does not look as expected:
    - Validate your HTML file using https://validator.w3.org/ & CSS https://jigsaw.w3.org/css-validator/
    - To debug HTML, view the file in Chrome web browser's print preview which will work almost exactly as IronPDF.
    - Read our detailed documentation on pixel perfect HTML to PDF: https://ironpdf.com/tutorials/pixel-perfect-html-to-pdf/

    Static Async version of the RenderZipFileAsPdf method.

    Declaration
    public static Task<PdfDocument> StaticRenderZipFileAsPdfAsync(string FilePath, string MainFile, ChromePdfRenderOptions Options = null)
    Parameters
    Type Name Description
    System.String FilePath

    Path to a Zip to be rendered as a PDF.

    System.String MainFile

    Name of the primary HTML file.

    ChromePdfRenderOptions Options

    Optional print options and settings as an instance of ChromePdfRenderOptions.

    Returns
    Type Description
    System.Threading.Tasks.Task<PdfDocument>

    A PdfDocument

    Implements

    IronSoftware.IExtensibleRenderer

    See Also

    HTML to PDF Examples
    Complete HTML to PDF Tutorial
    ChromePdfRenderOptions
    PdfDocument
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    Want to deploy IronPDF to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronPDF free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.