Class HTMLToPDFParams.Builder

    • Constructor Detail

      • Builder

        public Builder()
        Constructs a Builder instance.
    • Method Detail

      • includeHeaderFooter

        public HTMLToPDFParams.Builder includeHeaderFooter​(boolean includeHeaderFooter)
        Sets the includeHeaderFooter parameter. If true, default header and footer will be included in resulting PDF. The default header consists of the date and the document title. The default footer consists of the file name and page number.
        Parameters:
        includeHeaderFooter - true if default header and footer should be included in the resulting PDF. Default value is true.
        Returns:
        this Builder instance to add any additional parameters
      • withPageLayout

        public HTMLToPDFParams.Builder withPageLayout​(PageLayout pageLayout)
        Sets the pageLayout parameter.
        Parameters:
        pageLayout - intended page layout of the resulting PDF file.
        Returns:
        this Builder instance to add any additional parameters
      • withDataToMerge

        public HTMLToPDFParams.Builder withDataToMerge​(org.json.JSONObject dataToMerge)
        Sets the data to be used by the javascript in the source html file to manipulate the HTML DOM before it gets converted to PDF. This mechanism is intended to be used to supply data that might otherwise be retrieved using ajax requests.

        To make use of this mechanism, the source html file must include a script element such as:

        <script src='./json.js' type='text/javascript'></script>
              where json.js refers to the JSON data,
        And also Requires javascript in the source html file to make use of this JSON data to manipulate the HTML DOM.
        Parameters:
        dataToMerge - JSON object
        Returns:
        this Builder instance to add any additional parameters
      • build

        public HTMLToPDFParams build()
        Returns a new HTMLToPDFParams instance built from the current state of this builder.
        Returns:
        a new HTMLtoPDFParams instance.