Class Page.PdfOptions

  • Enclosing interface:
    Page

    public static class Page.PdfOptions
    extends java.lang.Object
    • Field Detail

      • displayHeaderFooter

        public java.lang.Boolean displayHeaderFooter
        Display header and footer. Defaults to false.
      • footerTemplate

        public java.lang.String footerTemplate
        HTML template for the print footer. Should use the same format as the headerTemplate.
      • format

        public java.lang.String format
        Paper format. If set, takes priority over width or height options. Defaults to 'Letter'.
      • headerTemplate

        public java.lang.String headerTemplate
        HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:
        • "date" formatted print date
        • "title" document title
        • "url" document location
        • "pageNumber" current page number
        • "totalPages" total pages in the document
      • height

        public java.lang.String height
        Paper height, accepts values labeled with units.
      • landscape

        public java.lang.Boolean landscape
        Paper orientation. Defaults to false.
      • margin

        public Margin margin
        Paper margins, defaults to none.
      • pageRanges

        public java.lang.String pageRanges
        Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
      • path

        public java.nio.file.Path path
        The file path to save the PDF to. If path is a relative path, then it is resolved relative to the current working directory. If no path is provided, the PDF won't be saved to the disk.
      • preferCSSPageSize

        public java.lang.Boolean preferCSSPageSize
        Give any CSS @page size declared in the page priority over what is declared in width and height or format options. Defaults to false, which will scale the content to fit the paper size.
      • printBackground

        public java.lang.Boolean printBackground
        Print background graphics. Defaults to false.
      • scale

        public java.lang.Double scale
        Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2.
      • width

        public java.lang.String width
        Paper width, accepts values labeled with units.
    • Constructor Detail

      • PdfOptions

        public PdfOptions()
    • Method Detail

      • setDisplayHeaderFooter

        public Page.PdfOptions setDisplayHeaderFooter​(boolean displayHeaderFooter)
        Display header and footer. Defaults to false.
      • setFooterTemplate

        public Page.PdfOptions setFooterTemplate​(java.lang.String footerTemplate)
        HTML template for the print footer. Should use the same format as the headerTemplate.
      • setFormat

        public Page.PdfOptions setFormat​(java.lang.String format)
        Paper format. If set, takes priority over width or height options. Defaults to 'Letter'.
      • setHeaderTemplate

        public Page.PdfOptions setHeaderTemplate​(java.lang.String headerTemplate)
        HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:
        • "date" formatted print date
        • "title" document title
        • "url" document location
        • "pageNumber" current page number
        • "totalPages" total pages in the document
      • setHeight

        public Page.PdfOptions setHeight​(java.lang.String height)
        Paper height, accepts values labeled with units.
      • setLandscape

        public Page.PdfOptions setLandscape​(boolean landscape)
        Paper orientation. Defaults to false.
      • setPageRanges

        public Page.PdfOptions setPageRanges​(java.lang.String pageRanges)
        Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
      • setPath

        public Page.PdfOptions setPath​(java.nio.file.Path path)
        The file path to save the PDF to. If path is a relative path, then it is resolved relative to the current working directory. If no path is provided, the PDF won't be saved to the disk.
      • setPreferCSSPageSize

        public Page.PdfOptions setPreferCSSPageSize​(boolean preferCSSPageSize)
        Give any CSS @page size declared in the page priority over what is declared in width and height or format options. Defaults to false, which will scale the content to fit the paper size.
      • setPrintBackground

        public Page.PdfOptions setPrintBackground​(boolean printBackground)
        Print background graphics. Defaults to false.
      • setScale

        public Page.PdfOptions setScale​(double scale)
        Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2.
      • setWidth

        public Page.PdfOptions setWidth​(java.lang.String width)
        Paper width, accepts values labeled with units.