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 Object
Clone()
SupportsCloneable
.CssMediaType
getCssMediaType()
Gets css media type.String
getCustomCssUrl()
Gets custom css url.double
getCustomPaperHeight()
Gets custom paper height.double
getCustomPaperWidth()
Gets custom paper width (mm).FitToPaperModes
getFitToPaperMode()
use one of these method insteadUseChromeDefaultRendering()
UseScaledRendering()
UseResponsiveCssRendering()
UseFitToPageRendering()
String
getInputEncoding()
Gets input character encoding as a string; e.g.String
getJavascript()
Get A custom javascript string to be executed after all HTML has loaded but before PDf rendering.double
getMarginBottom()
Gets margin bottom.double
getMarginLeft()
Gets margin left.double
getMarginRight()
Gets margin right.double
getMarginTop()
Gets margin top.PaperOrientation
getPaperOrientation()
Gets paper orientation.PaperSize
getPaperSize()
Gets paper size.TableOfContentsTypes
getTableOfContents()
Gets TableOfContents.String
getTitle()
Gets title.int
getViewPortHeight()
internal useint
getViewPortWidth()
internal useWaitFor
getWaitFor()
Gets a wrapper object that holds configuration for wait-for mechanism for user to wait for certain events before rendering.int
getZoom()
internal useboolean
isCreatePdfFormsFromHtml()
Is create pdf forms from html.boolean
isEnableJavaScript()
Is enable JavaScript.boolean
isGrayScale()
Is gray scale boolean.boolean
isPrintHtmlBackgrounds()
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.use one of these method insteadUseChromeDefaultRendering()
UseScaledRendering()
UseResponsiveCssRendering()
UseFitToPageRendering()
void
setGrayScale(boolean value)
Sets gray scale.void
setInputEncoding(String value)
Sets input character encoding as a string; e.g.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
setPaperOrientation(PaperOrientation value)
Sets paper orientation.void
setPaperSize(PaperSize value)
Sets paper size.void
setPrintHtmlBackgrounds(boolean value)
Sets print html backgrounds.void
setTableOfContents(TableOfContentsTypes value)
Sets TableOfContents.void
setTitle(String value)
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
UseChromeDefaultRendering()
Lays out PDF pages in the same way as when viewed from Google Chrome's print preview.void
UseContinuousFeedRendering()
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
UseFitToPageRendering()
Scales content to fit the specifiedsetPaperSize(PaperSize)
.void
UseFitToPageRendering(int minimumPixelWidth)
Scales content to fit the specifiedsetPaperSize(PaperSize)
.void
UseResponsiveCssRendering()
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
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.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.
-
-
-
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; e.g. "utf-8" "utf-16" "ASCII"- Returns:
- the input encoding
-
setInputEncoding
public void setInputEncoding(String value)
Sets input character encoding as a string; e.g. "utf-8" "utf-16" "ASCII"- Parameters:
value
- e.g. "utf-8", "utf-16", "ASCII" or else
-
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
-
getTableOfContents
public TableOfContentsTypes getTableOfContents()
Gets TableOfContents. Generate a table of contents at the location in the HTML document where an element is found with id "ironpdf-toc".- Returns:
- the title
-
setTableOfContents
public void setTableOfContents(TableOfContentsTypes value)
Sets TableOfContents. Generate a table of contents at the location in the HTML document where an element is found with id "ironpdf-toc".- Parameters:
value
- the value
-
-