Class ChromePdfRenderOptions
Html To PDF output options for ChromePdfRenderer. Specifies options such as Paper-Size, DPI, Headers and Footers and other Chromium specific browser setup options.
Inheritance
Namespace: IronPdf
Assembly: IronPdf.dll
Syntax
public class ChromePdfRenderOptions : Object
Constructors
ChromePdfRenderOptions()
Declaration
public ChromePdfRenderOptions()
Properties
CreatePdfFormsFromHtml
Turns all Html forms elements into editable PDF forms.
Default value is true.
Declaration
public bool CreatePdfFormsFromHtml { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CssMediaType
Enables Media="screen" CSS Styles and StyleSheets
Note: By setting AllowScreenCss=false, IronPdf renders PDFs from HTML using CSS for media="print" as if printing a web page in a browser print dialog.
Default value is PdfCssMediaType.Screen.
Declaration
public PdfCssMediaType CssMediaType { get; set; }
Property Value
Type | Description |
---|---|
PdfCssMediaType |
CustomCssUrl
Allows a custom CSS style-sheet to be applied to Html before rendering. May be a local file path, or remote url.
Declaration
public string CustomCssUrl { get; set; }
Property Value
Type | Description |
---|---|
System.String |
DefaultChrome
A ChromePdfRenderOptions preset with default settings that match the vanilla PDF viewer in Chrome.
Declaration
public static ChromePdfRenderOptions DefaultChrome { get; }
Property Value
Type | Description |
---|---|
ChromePdfRenderOptions |
EnableJavaScript
Enables JavaScript and Json to be executed before the page is rendered. Ideal for printing from Ajax / Angular Applications.
Also see RenderDelay
Default value is false.
Declaration
public bool EnableJavaScript { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
FirstPageNumber
First page number to be used in PDF Headers and Footers.
Default value is 1.
Declaration
public int FirstPageNumber { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
FitToPaperMode
Behavior when fitting HTML content to a physical paper size. Determines Zoom and ViewPortWidth.
See FitToPaperModes for a detailed description of each mode.
None disables automatic fitting behavior.
Automatic automatically measures and fits HTML content onto each PDF page.
Default value is FitToPaperModes.None.
Declaration
public FitToPaperModes FitToPaperMode { get; set; }
Property Value
Type | Description |
---|---|
FitToPaperModes |
ForcePaperSize
Force page sizes to be exactly what is specified via PaperSize by resizing the page after generating a PDF from HTML
Useful for bypassing CSS rules which specify paper size
Declaration
public bool ForcePaperSize { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Helps correct small errors in page size when rendering HTML to PDF
GrayScale
Outputs a black-and-white PDF
Default value is false.
Declaration
public bool GrayScale { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
HtmlFooter
Sets the footer content for every PDF page as Html. Supports 'mail-merge'.
Declaration
public HtmlHeaderFooter HtmlFooter { get; set; }
Property Value
Type | Description |
---|---|
HtmlHeaderFooter |
HtmlHeader
Sets the header content for every PDF page as Html. Supports 'mail-merge'.
Declaration
public HtmlHeaderFooter HtmlHeader { get; set; }
Property Value
Type | Description |
---|---|
HtmlHeaderFooter |
InputEncoding
The input character encoding as a string;
Default value is Encoding.UTF8.
Declaration
public Encoding InputEncoding { get; set; }
Property Value
Type | Description |
---|---|
System.Text.Encoding |
MarginBottom
Bottom Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.
Default value is 25.
Declaration
public double MarginBottom { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
MarginLeft
Left Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.
Default value is 25.
Declaration
public double MarginLeft { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
MarginRight
Right Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.
Default value is 25.
Declaration
public double MarginRight { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
MarginTop
Top Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.
Default value is 25.
Declaration
public double MarginTop { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
PaperOrientation
The PDF paper orientation. E.g. Portrait or Landscape.
Default value is Portrait.
Declaration
public PdfPaperOrientation PaperOrientation { get; set; }
Property Value
Type | Description |
---|---|
PdfPaperOrientation |
PaperSize
Set an output paper size for PDF pages. System.Drawing.Printing.PaperKind.
Use SetCustomPaperSize(int width, int height) for custom sizes.
Default value is A4.
Declaration
public PdfPaperSize PaperSize { get; set; }
Property Value
Type | Description |
---|---|
PdfPaperSize |
PrintHtmlBackgrounds
Prints background-colors and images from Html.
Default value is true.
Declaration
public bool PrintHtmlBackgrounds { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
RenderDelay
Milliseconds to wait after Html is rendered before printing. This can use useful when considering the rendering of JavaScript, Ajax or animations.
Default value is 0.
Declaration
public int RenderDelay { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
TextFooter
Sets the header content for every PDF page as text. Supports 'mail-merge' and automatically turns urls into hyperlinks..
Declaration
public TextHeaderFooter TextFooter { get; set; }
Property Value
Type | Description |
---|---|
TextHeaderFooter |
TextHeader
Sets the footer content for every PDF page as text. Supports 'mail-merge' and automatically turns urls into hyperlinks..
Declaration
public TextHeaderFooter TextHeader { get; set; }
Property Value
Type | Description |
---|---|
TextHeaderFooter |
Timeout
Render timeout in seconds
Default value is 60.
Declaration
public int Timeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Title
PDF Document Name and Title meta-data. Not required. Useful for mail-merge and automatic file naming in the IronPdf MVC and Razor extensions.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String |
UseMarginsOnHeaderAndFooter
Use margin values from the main document when rendering headers and footers
Declaration
public UseMargins UseMarginsOnHeaderAndFooter { get; set; }
Property Value
Type | Description |
---|---|
UseMargins |
ViewPortHeight
Defines a virtual screen height used to render HTML to PDF in IronPdf. Measured in pixels.
Viewport size is important in modern responsive HTML5 + CSS3 websites (e.g. Bootstrap framework websites) because the rendering and order of elements on the screen is dependent on viewport size.
The default viewport is 1280px wide by 1024px high to ensure the desktop version of a website is rendered unless otherwise specified. Smaller sizes (particularly width) will render responsive versions of many websites.
Declaration
public int ViewPortHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
ViewPortWidth
Defines a virtual screen width used to render HTML to PDF in IronPdf. Measured in pixels.
Viewport size is important in modern responsive HTML5 + CSS3 websites (e.g. Bootstrap framework websites) because the rendering and order of elements on the screen is dependent on viewport size.
The default viewport is 1280px wide by 1024px high to ensure the desktop version of a website is rendered unless otherwise specified. Smaller sizes (particularly width) will render responsive versions of many website
Declaration
public int ViewPortWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Zoom
Percentage zoom level when printing a document to PDF. Enlarges the rendering size of Html documents.
Only used when FitToPaperMode is set to None
Default value is 100.
Declaration
public int Zoom { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Clone()
Supports System.ICloneable. Creates a deep copy of this class instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A deep clone of this instance. Use explicit casting to convert object back to the intended type. |
SetCustomPaperSizeinCentimeters(Double, Double)
Set an output paper size for PDF pages. Dimensions are in Centimeters.
Declaration
public void SetCustomPaperSizeinCentimeters(double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | Custom paper width in cm. |
System.Double | height |
|
SetCustomPaperSizeInInches(Double, Double)
Set an output paper size for PDF pages. Dimensions are in Inches.
Declaration
public void SetCustomPaperSizeInInches(double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | Custom paper width in Inches. |
System.Double | height |
|
SetCustomPaperSizeinMilimeters(Double, Double)
Set an output paper size for PDF pages. Dimensions are in millimeters.
Declaration
public void SetCustomPaperSizeinMilimeters(double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | Custom paper width in millimeters. |
System.Double | height |
|
SetCustomPaperSizeinPixelsOrPoints(Double, Double, Int32)
Set an output paper size for PDF pages. Dimensions are in screen Pixels or printer Points.
Declaration
public void SetCustomPaperSizeinPixelsOrPoints(double width, double height, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | Custom paper width in pixels/points. |
System.Double | height |
|
System.Int32 | DPI |
|