Class ChromePdfRenderer
IronPdf.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 recommend Chrome
Implements
Inherited Members
Namespace: IronPdf
Assembly: IronPdf.dll
Syntax
public class ChromePdfRenderer : BasePdfRenderer, IPdfRenderer
Constructors
ChromePdfRenderer()
Create a new Chrome Html To PDF renderer.
Declaration
public ChromePdfRenderer()
Methods
ApplyCookies(String, ChromeHttpLoginCredentials)
Applies cookies from the specified login credentials class to the specified url
Declaration
public static void ApplyCookies(string Url, ChromeHttpLoginCredentials Login)
Parameters
Type | Name | Description |
---|---|---|
System. |
Url | Url cookies will apply to |
Chrome |
Login | Login credentials which includes CustomCookies property |
ClearCookies()
Clear cookies for all urls
Declaration
public static void ClearCookies()
StaticRenderHtmlAsPdf(String, ChromePdfRenderOptions, String)
Creates a PDF file from an Html string, and returns it as an Pdf
Static version of the RenderHtmlAsPdf method.
Declaration
public static PdfDocument StaticRenderHtmlAsPdf(string Html, ChromePdfRenderOptions Options = null, string Proxy = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
Html | The Html to be rendered as a PDF. |
Chrome |
Options | An instance of Chrome |
System. |
Proxy | Specifies an Http proxy server. Use the pattern: http(s)://user-name:password@host:port |
Returns
Type | Description |
---|---|
Pdf |
A Pdf |
StaticRenderHtmlAsPdf(String, String, ChromePdfRenderOptions, String)
Creates a PDF file from an Html string, and returns it as an Pdf
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. |
Html | The Html to be rendered as a PDF. |
System. |
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. |
Chrome |
Options | An instance of Chrome |
System. |
Proxy | Specifies an Http proxy server. Use the pattern: http(s)://user-name:password@host:port |
Returns
Type | Description |
---|---|
Pdf |
A Pdf |
StaticRenderHtmlAsPdf(String, Uri, ChromePdfRenderOptions, String)
Creates a PDF file from an Html string, and returns it as an Pdf
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. |
Html | The Html to be rendered as a PDF. |
System. |
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. |
Chrome |
Options | An instance of Chrome |
System. |
Proxy | Specifies an Http proxy server. Use the pattern: http(s)://user-name:password@host:port |
Returns
Type | Description |
---|---|
Pdf |
A Pdf |
StaticRenderHtmlAsPdfAsync(String, Uri, ChromePdfRenderOptions)
Creates a PDF file from an Html string, and returns it as an Pdf
Static Async version of the RenderHtmlAsPdf method.
Declaration
public static Task<PdfDocument> StaticRenderHtmlAsPdfAsync(string Html, Uri BaseUrl = null, ChromePdfRenderOptions Options = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
Html | The Html to be rendered as a PDF. |
System. |
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. |
Chrome |
Options | An instance of Chrome |
Returns
Type | Description |
---|---|
System. |
A Pdf |
StaticRenderHTMLFileAsPdf(String, ChromePdfRenderOptions)
Renders an HTML file as a PDF file. Returns a Pdf
Static version of the RenderHTMLFileAsPdf method.
Declaration
public static PdfDocument StaticRenderHTMLFileAsPdf(string FilePath, ChromePdfRenderOptions Options = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
FilePath | Path to an Html file. |
Chrome |
Options | Optional print options and settings as an instance of Chrome |
Returns
Type | Description |
---|---|
Pdf |
A Pdf |
StaticRenderHTMLFileAsPdfAsync(String, ChromePdfRenderOptions)
Renders an HTML file as a PDF file. Returns a Pdf
Static Async version of the RenderHTMLFileAsPdf method.
Declaration
public static Task<PdfDocument> StaticRenderHTMLFileAsPdfAsync(string FilePath, ChromePdfRenderOptions Options = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
FilePath | Path to an Html file. |
Chrome |
Options | Optional print options and settings as an instance of Chrome |
Returns
Type | Description |
---|---|
System. |
A Pdf |
StaticRenderUrlAsPdf(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 version of the RenderUrlAsPdf method.
Declaration
public static PdfDocument StaticRenderUrlAsPdf(string UrlOrPath, ChromePdfRenderOptions Options = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
UrlOrPath | An absolute Url. Points to the Html document to be rendered as a PDF. |
Chrome |
Options | Optional print options and settings as an instance of Chrome |
Returns
Type | Description |
---|---|
Pdf |
A Pdf |
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. |
Url | An absolute Uri. Points to the Html document or local file file to be rendered as a PDF. |
Chrome |
Options | Optional print options and settings as an instance of Chrome |
Returns
Type | Description |
---|---|
Pdf |
A Pdf |
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. |
UrlOrPath | An absolute Url. Points to the Html document or local file to be rendered as a PDF. |
Chrome |
Options | Optional print options and settings as an instance of Chrome |
Returns
Type | Description |
---|---|
System. |
A Pdf |
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. |
Url | An absolute Uri. Points to the Html document or local file file to be rendered as a PDF. |
Chrome |
Options | Optional print options and settings as an instance of Chrome |
Returns
Type | Description |
---|---|
System. |
A Pdf |
StaticRenderZipFileAsPdf(String, String, ChromePdfRenderOptions)
Creates a PDF file from a local Zip file, and returns it as a Pdf
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. |
FilePath | Path to an Zip to be rendered as a PDF. |
System. |
MainFile | Name of the primary HTML file. |
Chrome |
Options | Optional print options and settings as an instance of Chrome |
Returns
Type | Description |
---|---|
Pdf |
StaticRenderZipFileAsPdfAsync(String, String, ChromePdfRenderOptions)
Creates a PDF file from a local Zip file, and returns it as a Pdf
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. |
FilePath | Path to an Zip to be rendered as a PDF. |
System. |
MainFile | Name of the primary HTML file. |
Chrome |
Options | Optional print options and settings as an instance of Chrome |
Returns
Type | Description |
---|---|
System. |