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 for Render_Api. Specify options such as Paper-Size, DPI, and other Chromium specific browser setup options.
  • 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

      public CssMediaType getCssMediaType()
      Gets css media type. 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.

      Returns:
      the css media type
    • setCssMediaType

      public void setCssMediaType(CssMediaType value)
      Sets css media type. 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.

      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()
    • setFitToPaperMode

      public void setFitToPaperMode(FitToPaperModes value)
    • 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
      Supports Cloneable. 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 Size setPaperSize(PaperSize). To change this responsive behavior use UseResponsiveCssRendering()
    • 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 the setPaperSize(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 the setPaperSize(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 the setPaperSize(PaperSize) Specified Paper Size Set setCssMediaType(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 the setPaperSize(PaperSize) Specified Paper Size Set setCssMediaType(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 specified setPaperSize(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 specified setPaperSize(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 80
      margin - The margin in millimeters to apply to the PDF page. Default is 5