Class HtmlHeaderFooter

    • Constructor Detail

      • HtmlHeaderFooter

        public HtmlHeaderFooter()
        Instantiates a new Html header footer.
      • HtmlHeaderFooter

        public HtmlHeaderFooter​(String htmlFragment)
        Instantiates a new Html header footer.
        Parameters:
        htmlFragment - the html fragment
    • Method Detail

      • getMaxHeight

        public Integer getMaxHeight()
        Maximum Height of the Html Header / Footer in millimeters. This value must be set sufficiently high to display the full html header / footer content.
        Returns:
        the max height
      • setMaxHeight

        public void setMaxHeight​(Integer value)
        Maximum Height of the Html Header / Footer in millimeters. This value must be set sufficiently high to display the full html header / footer content.
        Parameters:
        value - the value
      • isDrawDividerLine

        public boolean isDrawDividerLine()
        A horizontal line divider between the header / footer and the page content on every page of the PDF document.
        Returns:
        the boolean
      • setDrawDividerLine

        public void setDrawDividerLine​(boolean value)
        Adds a horizontal line divider between the header / footer and the page content on every page of the PDF document.
        Parameters:
        value - the value
      • getBaseUrl

        public String getBaseUrl()
        The Base URL all URLS in the htmlFragment" will be relative to. This includes 'src' attributes on images, scripts, style-sheets and also hrefs on hyperlinks.

        Note: A base URL that points to a directory should end with a slash.

        Base URL accepts file paths as well as URLS. If no BaseUrl is given, the HtmlHeaderFooter BaseUrl will be inherited from the main HTML document where possible.

        Returns:
        the base url
      • setBaseUrl

        public void setBaseUrl​(String value)
        The Base URL all URLS in the htmlFragment" will be relative to. This includes 'src' attributes on images, scripts, style-sheets and also hrefs on hyperlinks.

        Note: A base URL that points to a directory should end with a slash.

        Base URL accepts file paths as well as URLS. If no BaseUrl is given, the HtmlHeaderFooter BaseUrl will be inherited from the main HTML document where possible.

        Parameters:
        value - the value
      • getHtmlFragment

        public String getHtmlFragment()
        The Html which will be used to render the Header / Footer. Should be a Html snippet rather than a complete document. May contain styles & images.

        Merge meta-data into the HtmlFragment by putting any of these placeholder strings into the text: {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}. An alternative mail-merge style using the pattern <span class='total-pages'></span> also work

        HtmlFragment is a stand alone HTML document which does not inherit styles or settings from your main HTML content unless loadStylesAndCSSFromMainHtmlDocument is set true

        Returns:
        the html fragment
      • setHtmlFragment

        public void setHtmlFragment​(String value)
        The Html which will be used to render the Header / Footer. Should be a Html snippet rather than a complete document. May contain styles & images.

        Merge meta-data into the HtmlFragment by putting any of these placeholder strings into the text: {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}. An alternative mail-merge style using the pattern <span class='total-pages'></span> also work

        HtmlFragment is a stand alone HTML document which does not inherit styles or settings from your main HTML content unless loadStylesAndCSSFromMainHtmlDocument is set true

        Parameters:
        value - the value
      • isLoadStylesAndCSSFromMainHtmlDocument

        public boolean isLoadStylesAndCSSFromMainHtmlDocument()
        Loads style code blocks and links to CSS style sheets from the main HTML document (which provides the PDF content) into the HtmlHeaderFooter .

        By default, Html Headers and Footers are stand- alone HTML documents with their own default styles. Setting loadStylesAndCSSFromMainHtmlDocument to true will attempt to load all STYLE and LINK tags from the main HTML document (which renders teh PDF) into the HtmlHeaderFooter .

        If your main HTML document contains complex CSS frameworks, styles the HEAD or BODY element heavily or loads CSS from javascript then this method may not work as intended.

        This feature is not available for RenderUrlAsPdf methods. It works for HTMLToPdf and HtmlFileToPdf conversions only.

        It is often preferable to load style sheets explicitly into your HTML Headers and Footers as STYLE and LINK tags within the htmlFragment for granular control

        Returns:
        the boolean
      • setLoadStylesAndCSSFromMainHtmlDocument

        public void setLoadStylesAndCSSFromMainHtmlDocument​(boolean value)
        Loads style code blocks and links to CSS style sheets from the main HTML document (which provides the PDF content) into the HtmlHeaderFooter .

        By default, Html Headers and Footers are stand- alone HTML documents with their own default styles. Setting loadStylesAndCSSFromMainHtmlDocument to true will attempt to load all STYLE and LINK tags from the main HTML document (which renders teh PDF) into the HtmlHeaderFooter .

        If your main HTML document contains complex CSS frameworks, styles the HEAD or BODY element heavily or loads CSS from javascript then this method may not work as intended.

        This feature is not available for RenderUrlAsPdf methods. It works for HTMLToPdf and HtmlFileToPdf conversions only.

        It is often preferable to load style sheets explicitly into your HTML Headers and Footers as STYLE and LINK tags within the htmlFragment for granular control

        Parameters:
        value - the value