Package com.ironsoftware.ironpdf.render
Class ChromePdfRenderOptions
- java.lang.Object
-
- com.ironsoftware.ironpdf.render.ChromePdfRenderOptions
-
- All Implemented Interfaces:
Cloneable
public class ChromePdfRenderOptions extends Object implements Cloneable
Html To PDF output options forRender_Api. Specify options such as Paper-Size, DPI, and other Chromium specific browser setup options.
-
-
Constructor Summary
Constructors Constructor Description ChromePdfRenderOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ObjectClone()SupportsCloneable.CssMediaTypegetCssMediaType()Gets css media type.StringgetCustomCssUrl()Gets custom css url.doublegetCustomPaperHeight()Gets custom paper height.doublegetCustomPaperWidth()Gets custom paper width (mm).FitToPaperModesgetFitToPaperMode()use one of these method insteadUseChromeDefaultRendering()UseScaledRendering()UseResponsiveCssRendering()UseFitToPageRendering()StringgetInputEncoding()Gets input character encoding as a string;StringgetJavascript()Get A custom javascript string to be executed after all HTML has loaded but before PDf rendering.doublegetMarginBottom()Gets margin bottom.doublegetMarginLeft()Gets margin left.doublegetMarginRight()Gets margin right.doublegetMarginTop()Gets margin top.PaperOrientationgetPaperOrientation()Gets paper orientation.PaperSizegetPaperSize()Gets paper size.StringgetTitle()Gets title.intgetViewPortHeight()internal useintgetViewPortWidth()internal useWaitForgetWaitFor()Gets a wrapper object that holds configuration for wait-for mechanism for user to wait for certain events before rendering.intgetZoom()internal usebooleanisCreatePdfFormsFromHtml()Is create pdf forms from html.booleanisEnableJavaScript()Is enable JavaScript.booleanisGrayScale()Is gray scale boolean.booleanisPrintHtmlBackgrounds()Is print html backgrounds boolean.voidsetCreatePdfFormsFromHtml(boolean value)Sets create pdf forms from html.voidsetCssMediaType(CssMediaType value)Sets css media type.voidsetCustomCssUrl(String value)Sets custom css url.voidsetCustomPaperHeight(double value)Sets custom paper height (mm).voidsetCustomPaperSizeInCentimeters(double width, double height)Set an output paper size for PDF pages.voidSetCustomPaperSizeInInches(double width, double height)Set an output paper size for PDF pages.voidsetCustomPaperSizeInMillimeters(double width, double height)Set an output paper size for PDF pages.voidsetCustomPaperSizeInPixelsOrPoints(double width, double height)Set an output paper size for PDF pages.voidsetCustomPaperSizeInPixelsOrPoints(double width, double height, int DPI)Set an output paper size for PDF pages.voidsetCustomPaperWidth(double value)Sets custom paper width (mm).voidsetEnableJavaScript(boolean value)Sets enable JavaScript.voidsetFitToPaperMode(FitToPaperModes value)Deprecated.use one of these method insteadUseChromeDefaultRendering()UseScaledRendering()UseResponsiveCssRendering()UseFitToPageRendering()voidsetGrayScale(boolean value)Sets gray scale.voidsetJavascript(String javascript)Set A custom javascript string to be executed after all HTML has loaded but before PDf rendering.voidsetMarginBottom(double value)Sets margin bottom.voidsetMarginLeft(double value)Sets margin left.voidsetMarginRight(double value)Sets margin right.voidsetMarginTop(double value)Sets margin top.voidsetPaperOrientation(PaperOrientation value)Sets paper orientation.voidsetPaperSize(PaperSize value)Sets paper size.voidsetPrintHtmlBackgrounds(boolean value)Sets print html backgrounds.voidsetTitle(String value)Sets title.voidsetWaitFor(WaitFor waitFor)Sets a wrapper object that holds configuration for wait-for mechanism for user to wait for certain events before rendering.voidUseChromeDefaultRendering()Lays out PDF pages in the same way as when viewed from Google Chrome's print preview.voidUseContinuousFeedRendering()Creates a single page PDF which will force its entire content's width and height to fit into one page.voidUseContinuousFeedRendering(double width)Creates a single page PDF which will force its entire content's width and height to fit into one page.voidUseContinuousFeedRendering(double width, int margin)Creates a single page PDF which will force its entire content's width and height to fit into one page.voidUseContinuousFeedRendering(int margin)Creates a single page PDF which will force its entire content's width and height to fit into one page.voidUseFitToPageRendering()Scales content to fit the specifiedsetPaperSize(PaperSize).voidUseFitToPageRendering(int minimumPixelWidth)Scales content to fit the specifiedsetPaperSize(PaperSize).voidUseResponsiveCssRendering()Uses Responsive CSS to define the rendering of the HTML based on the ViewPortWidth parameter.voidUseResponsiveCssRendering(int viewPortWidthValue)Uses Responsive CSS to define the rendering of the HTML based on the ViewPortWidth parameter.voidUseScaledRendering()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.voidUseScaledRendering(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.
-
-
-
Method Detail
-
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
public CssMediaType 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
public void setCssMediaType(CssMediaType value)
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
public String 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
public void setCustomCssUrl(String value)
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
public FitToPaperModes getFitToPaperMode()
use one of these method insteadUseChromeDefaultRendering()UseScaledRendering()UseResponsiveCssRendering()UseFitToPageRendering()
-
setFitToPaperMode
public void setFitToPaperMode(FitToPaperModes value)
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
public String 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
public PaperOrientation getPaperOrientation()
Gets paper orientation. The PDF paper orientation. E.g. Portrait or Landscape.- Returns:
- the paper orientation
-
setPaperOrientation
public void setPaperOrientation(PaperOrientation value)
Sets paper orientation. The PDF paper orientation. E.g. Portrait or Landscape.- Parameters:
value- the value
-
getPaperSize
public PaperSize 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
public void setPaperSize(PaperSize value)
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
public String getTitle()
Gets title. PDF Document Name and Title meta-data. Not required. Useful for mail-merge and file naming.- Returns:
- the title
-
setTitle
public void setTitle(String value)
Sets title. PDF Document Name and Title meta-data. Not required. Useful for mail-merge and file naming.- Parameters:
value- the value
-
getJavascript
public String getJavascript()
Get A custom javascript string to be executed after all HTML has loaded but before PDf rendering.- Returns:
- the javascript string
-
Clone
public Object Clone() throws CloneNotSupportedException
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
public void setJavascript(String javascript)
Set A custom javascript string to be executed after all HTML has loaded but before PDf rendering.- Parameters:
javascript- a javascript string.
-
getWaitFor
public WaitFor 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
public void setWaitFor(WaitFor waitFor)
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
-
-