Package com.ironsoftware.ironpdf.render
Class ChromePdfRenderOptions
java.lang.Object
com.ironsoftware.ironpdf.render.ChromePdfRenderOptions
- All Implemented Interfaces:
Cloneable
Html To PDF output options for
Render_Api
. Specify options such as Paper-Size, DPI,
and other Chromium specific browser setup options.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClone()
SupportsCloneable
.Gets css media type.Gets custom css url.double
Gets custom paper height.double
Gets custom paper width (mm).use one of these method insteadUseChromeDefaultRendering()
UseScaledRendering()
UseResponsiveCssRendering()
UseFitToPageRendering()
Gets input character encoding as a string;Get A custom javascript string to be executed after all HTML has loaded but before PDf rendering.double
Gets margin bottom.double
Gets margin left.double
Gets margin right.double
Gets margin top.Gets paper orientation.Gets paper size.getTitle()
Gets title.int
internal useint
internal useGets a wrapper object that holds configuration for wait-for mechanism for user to wait for certain events before rendering.int
getZoom()
internal useboolean
Is create pdf forms from html.boolean
Is enable JavaScript.boolean
Is gray scale boolean.boolean
Is print html backgrounds boolean.void
setCreatePdfFormsFromHtml
(boolean value) Sets create pdf forms from html.void
setCssMediaType
(CssMediaType value) Sets css media type.void
setCustomCssUrl
(String value) Sets custom css url.void
setCustomPaperHeight
(double value) Sets custom paper height (mm).void
setCustomPaperSizeInCentimeters
(double width, double height) Set an output paper size for PDF pages.void
SetCustomPaperSizeInInches
(double width, double height) Set an output paper size for PDF pages.void
setCustomPaperSizeInMillimeters
(double width, double height) Set an output paper size for PDF pages.void
setCustomPaperSizeInPixelsOrPoints
(double width, double height) Set an output paper size for PDF pages.void
setCustomPaperSizeInPixelsOrPoints
(double width, double height, int DPI) Set an output paper size for PDF pages.void
setCustomPaperWidth
(double value) Sets custom paper width (mm).void
setEnableJavaScript
(boolean value) Sets enable JavaScript.void
setFitToPaperMode
(FitToPaperModes value) Deprecated.void
setGrayScale
(boolean value) Sets gray scale.void
setJavascript
(String javascript) Set A custom javascript string to be executed after all HTML has loaded but before PDf rendering.void
setMarginBottom
(double value) Sets margin bottom.void
setMarginLeft
(double value) Sets margin left.void
setMarginRight
(double value) Sets margin right.void
setMarginTop
(double value) Sets margin top.void
Sets paper orientation.void
setPaperSize
(PaperSize value) Sets paper size.void
setPrintHtmlBackgrounds
(boolean value) Sets print html backgrounds.void
Sets title.void
setWaitFor
(WaitFor waitFor) Sets a wrapper object that holds configuration for wait-for mechanism for user to wait for certain events before rendering.void
Lays out PDF pages in the same way as when viewed from Google Chrome's print preview.void
Creates a single page PDF which will force its entire content's width and height to fit into one page.void
UseContinuousFeedRendering
(double width) Creates a single page PDF which will force its entire content's width and height to fit into one page.void
UseContinuousFeedRendering
(double width, int margin) Creates a single page PDF which will force its entire content's width and height to fit into one page.void
UseContinuousFeedRendering
(int margin) Creates a single page PDF which will force its entire content's width and height to fit into one page.void
Scales content to fit the specifiedsetPaperSize(PaperSize)
.void
UseFitToPageRendering
(int minimumPixelWidth) Scales content to fit the specifiedsetPaperSize(PaperSize)
.void
Uses Responsive CSS to define the rendering of the HTML based on the ViewPortWidth parameter.void
UseResponsiveCssRendering
(int viewPortWidthValue) Uses Responsive CSS to define the rendering of the HTML based on the ViewPortWidth parameter.void
Adopts a layout which behaves in the same way the 'Chrome Print Preview' does for a given paper size, with an additional zoom level applied to allow content to be manually scaled by the developer.void
UseScaledRendering
(int zoomPercentage) Adopts a layout which behaves in the same way the 'Chrome Print Preview' does for a given paper size, with an additional zoom level applied to allow content to be manually scaled by the developer.
-
Constructor Details
-
ChromePdfRenderOptions
public ChromePdfRenderOptions()
-
-
Method Details
-
isCreatePdfFormsFromHtml
public boolean isCreatePdfFormsFromHtml()Is create pdf forms from html. Turns all Html forms elements into editable PDF forms.- Returns:
- the boolean
-
setCreatePdfFormsFromHtml
public void setCreatePdfFormsFromHtml(boolean value) Sets create pdf forms from html. Turns all Html forms elements into editable PDF forms.- Parameters:
value
- the value
-
getCssMediaType
Gets css media type. Enables Media="screen" CSS Styles and StyleSheetsNote: 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.
- Returns:
- the css media type
-
setCssMediaType
Sets css media type. Enables Media="screen" CSS Styles and StyleSheetsNote: 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.
- Parameters:
value
- the value
-
getCustomCssUrl
Gets custom css url. Allows a custom CSS style-sheet to be applied to Html before rendering. Maybe a local file path, or remote url.- Returns:
- the custom css url
-
setCustomCssUrl
Sets custom css url. Allows a custom CSS style-sheet to be applied to Html before rendering. Maybe a local file path, or remote url.- Parameters:
value
- the value
-
getCustomPaperHeight
public double getCustomPaperHeight()Gets custom paper height.- Returns:
- the custom paper height
-
setCustomPaperHeight
public void setCustomPaperHeight(double value) Sets custom paper height (mm).- Parameters:
value
- the value
-
getCustomPaperWidth
public double getCustomPaperWidth()Gets custom paper width (mm).- Returns:
- the custom paper width
-
setCustomPaperWidth
public void setCustomPaperWidth(double value) Sets custom paper width (mm).- Parameters:
value
- the value
-
isEnableJavaScript
public boolean isEnableJavaScript()Is enable JavaScript. Enables JavaScript and Json to be executed before the page is rendered. Ideal for printing from Ajax / Angular Applications.Also see
waitFor
- Returns:
- the boolean
-
setEnableJavaScript
public void setEnableJavaScript(boolean value) Sets enable JavaScript. Enables JavaScript and Json to be executed before the page is rendered. Ideal for printing from Ajax / Angular Applications.Also see
waitFor
- Parameters:
value
- the value
-
getFitToPaperMode
use one of these method insteadUseChromeDefaultRendering()
UseScaledRendering()
UseResponsiveCssRendering()
UseFitToPageRendering()
-
setFitToPaperMode
Deprecated.use one of these method insteadUseChromeDefaultRendering()
UseScaledRendering()
UseResponsiveCssRendering()
UseFitToPageRendering()
-
isGrayScale
public boolean isGrayScale()Is gray scale boolean. Outputs a black-and-white PDF.- Returns:
- the boolean
-
setGrayScale
public void setGrayScale(boolean value) Sets gray scale. Outputs a black-and-white PDF.- Parameters:
value
- the value
-
getInputEncoding
Gets input character encoding as a string;- Returns:
- the input encoding
-
getMarginBottom
public double getMarginBottom()Gets margin bottom. Bottom Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.- Returns:
- the margin bottom
-
setMarginBottom
public void setMarginBottom(double value) Sets margin bottom. Bottom Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.- Parameters:
value
- the value
-
getMarginLeft
public double getMarginLeft()Gets margin left. Left Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.- Returns:
- the margin left
-
setMarginLeft
public void setMarginLeft(double value) Sets margin left. Left Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.- Parameters:
value
- the value
-
getMarginRight
public double getMarginRight()Gets margin right. Right Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.- Returns:
- the margin right
-
setMarginRight
public void setMarginRight(double value) Sets margin right. Right Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.- Parameters:
value
- the value
-
getMarginTop
public double getMarginTop()Gets margin top. Top Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.- Returns:
- the margin top
-
setMarginTop
public void setMarginTop(double value) Sets margin top. Top Pdf "paper" margin in millimeters. Set to zero for border-less and commercial printing applications.- Parameters:
value
- the value
-
getPaperOrientation
Gets paper orientation. The PDF paper orientation. E.g. Portrait or Landscape.- Returns:
- the paper orientation
-
setPaperOrientation
Sets paper orientation. The PDF paper orientation. E.g. Portrait or Landscape.- Parameters:
value
- the value
-
getPaperSize
Gets paper size. Set an output paper size for PDF pages.Use
setCustomPaperSizeInMillimeters(double, double)
,setCustomPaperSizeInPixelsOrPoints(double, double)
, etc... for custom sizes.- Returns:
- the paper size
-
setPaperSize
Sets paper size. Set an output paper size for PDF pages.Use
setCustomPaperSizeInMillimeters(double, double)
,setCustomPaperSizeInPixelsOrPoints(double, double)
, etc... for custom sizes.- Parameters:
value
- the value
-
isPrintHtmlBackgrounds
public boolean isPrintHtmlBackgrounds()Is print html backgrounds boolean. Prints background-colors and images from Html.- Returns:
- the boolean
-
setPrintHtmlBackgrounds
public void setPrintHtmlBackgrounds(boolean value) Sets print html backgrounds. Prints background-colors and images from Html.- Parameters:
value
- the value
-
getTitle
Gets title. PDF Document Name and Title meta-data. Not required. Useful for mail-merge and file naming.- Returns:
- the title
-
setTitle
Sets title. PDF Document Name and Title meta-data. Not required. Useful for mail-merge and file naming.- Parameters:
value
- the value
-
getJavascript
Get A custom javascript string to be executed after all HTML has loaded but before PDf rendering.- Returns:
- the javascript string
-
Clone
SupportsCloneable
. Creates a deep copy of this class instance.- Returns:
- A deep clone of this instance. Use explicit casting to convert object back to the intended type.
- Throws:
CloneNotSupportedException
- the clone not supported exception
-
setCustomPaperSizeInCentimeters
public void setCustomPaperSizeInCentimeters(double width, double height) Set an output paper size for PDF pages. Dimensions are in Centimeters.- Parameters:
width
- Custom paper width in cm.height
- Custom paper height in cm.
-
setCustomPaperSizeInMillimeters
public void setCustomPaperSizeInMillimeters(double width, double height) Set an output paper size for PDF pages. Dimensions are in millimeters.- Parameters:
width
- Custom paper width in millimeters.height
- Custom paper height in millimeters.
-
setCustomPaperSizeInPixelsOrPoints
public void setCustomPaperSizeInPixelsOrPoints(double width, double height) Set an output paper size for PDF pages. Dimensions are in screen Pixels or printer Points.- Parameters:
width
- Custom paper width in pixels/points.height
- Custom paper height in pixels/points..
-
setCustomPaperSizeInPixelsOrPoints
public void setCustomPaperSizeInPixelsOrPoints(double width, double height, int DPI) Set an output paper size for PDF pages. Dimensions are in screen Pixels or printer Points.- Parameters:
width
- Custom paper width in pixels/points.height
- Custom paper height in pixels/points.DPI
- Intended print resolution of the PDF. To be clear PDFs have no fixed DPI/PPI value for rendering. 72 and 96 are common onscreen values. 300 is a common value used in commercial printing.
-
SetCustomPaperSizeInInches
public void SetCustomPaperSizeInInches(double width, double height) Set an output paper size for PDF pages. Dimensions are in Inches.- Parameters:
width
- Custom paper width in Inches.height
- Custom paper height in Inches.
-
setJavascript
Set A custom javascript string to be executed after all HTML has loaded but before PDf rendering.- Parameters:
javascript
- a javascript string.
-
getWaitFor
Gets a wrapper object that holds configuration for wait-for mechanism for user to wait for certain events before rendering. By default, it will wait for nothing. -
setWaitFor
Sets a wrapper object that holds configuration for wait-for mechanism for user to wait for certain events before rendering. By default, it will wait for nothing. -
getViewPortWidth
public int getViewPortWidth()internal use -
getViewPortHeight
public int getViewPortHeight()internal use -
getZoom
public int getZoom()internal use -
UseChromeDefaultRendering
public void UseChromeDefaultRendering()Lays out PDF pages in the same way as when viewed from Google Chrome's print preview. Responsive CSS viewport is interpreted based on the width of the Specified Paper SizesetPaperSize(PaperSize)
. To change this responsive behavior useUseResponsiveCssRendering()
-
UseScaledRendering
public void UseScaledRendering()Adopts a layout which behaves in the same way the 'Chrome Print Preview' does for a given paper size, with an additional zoom level applied to allow content to be manually scaled by the developer. Responsive CSS is interpreted based on the width of thesetPaperSize(PaperSize)
Specified Paper Size -
UseScaledRendering
public void UseScaledRendering(int zoomPercentage) Adopts a layout which behaves in the same way the 'Chrome Print Preview' does for a given paper size, with an additional zoom level applied to allow content to be manually scaled by the developer. Responsive CSS is interpreted based on the width of thesetPaperSize(PaperSize)
Specified Paper Size- Parameters:
zoomPercentage
- A percentage based scale factor on the HTML document.
-
UseResponsiveCssRendering
public void UseResponsiveCssRendering()Uses Responsive CSS to define the rendering of the HTML based on the ViewPortWidth parameter. Content will attempt to scale the rendered content to fill the width of thesetPaperSize(PaperSize)
Specified Paper Size SetsetCssMediaType(com.ironsoftware.ironpdf.render.CssMediaType)
to choose between paper and screen CSS interpretations. -
UseResponsiveCssRendering
public void UseResponsiveCssRendering(int viewPortWidthValue) Uses Responsive CSS to define the rendering of the HTML based on the ViewPortWidth parameter. Content will attempt to scale the rendered content to fill the width of thesetPaperSize(PaperSize)
Specified Paper Size SetsetCssMediaType(com.ironsoftware.ironpdf.render.CssMediaType)
to choose between paper and screen CSS interpretations.- Parameters:
viewPortWidthValue
- A pixel based virtual browser viewport for responsive CSS designs.
-
UseFitToPageRendering
public void UseFitToPageRendering()Scales content to fit the specifiedsetPaperSize(PaperSize)
. This mode measures minimum HTML content width after it is rendered by the browser, and then scales that content to fit to 1 sheet of paper wide where possible. A minimum width can be set to control scaling and also to ensure that responsive CSS rules are correctly applied. -
UseFitToPageRendering
public void UseFitToPageRendering(int minimumPixelWidth) Scales content to fit the specifiedsetPaperSize(PaperSize)
. This mode measures minimum HTML content width after it is rendered by the browser, and then scales that content to fit to 1 sheet of paper wide where possible. A minimum width can be set to control scaling and also to ensure that responsive CSS rules are correctly applied.- Parameters:
minimumPixelWidth
- A pixel based minimum with for the document. Can help HTML elements to display correctly and respond appropriately to CSS3 responsive layout rules.
-
UseContinuousFeedRendering
public void UseContinuousFeedRendering()Creates a single page PDF which will force its entire content's width and height to fit into one page. Can be used for a consumer bill or receipt. -
UseContinuousFeedRendering
public void UseContinuousFeedRendering(int margin) Creates a single page PDF which will force its entire content's width and height to fit into one page. Can be used for a consumer bill or receipt.- Parameters:
margin
- The margin in millimeters to apply to the PDF page. Default is 5
-
UseContinuousFeedRendering
public void UseContinuousFeedRendering(double width) Creates a single page PDF which will force its entire content's width and height to fit into one page. Can be used for a consumer bill or receipt.- Parameters:
width
- The width in millimeters to apply to the PDF page. Default is 80
-
UseContinuousFeedRendering
public void UseContinuousFeedRendering(double width, int margin) Creates a single page PDF which will force its entire content's width and height to fit into one page. Can be used for a consumer bill or receipt.- Parameters:
width
- The width in millimeters to apply to the PDF page. Default is 80margin
- The margin in millimeters to apply to the PDF page. Default is 5
-
UseChromeDefaultRendering()
UseScaledRendering()
UseResponsiveCssRendering()
UseFitToPageRendering()