Class PDFExportJobRequest

  • All Implemented Interfaces:
    Serializable, org.xwiki.job.Request

    @Unstable
    public class PDFExportJobRequest
    extends AbstractCheckRightsRequest
    Represents a request to export multiple XWiki documents as PDF.
    Since:
    14.4.2, 14.5
    Version:
    $Id: d50d47121fa51dfa41f89f06512dabb6ca998d38 $
    See Also:
    Serialized Form
    • Constructor Detail

      • PDFExportJobRequest

        public PDFExportJobRequest()
        Default constructor.
      • PDFExportJobRequest

        public PDFExportJobRequest​(org.xwiki.job.Request request)
        Parameters:
        request - the request to copy
        Since:
        14.7RC1, 14.4.4, 13.10.9
    • Method Detail

      • getDocuments

        public List<org.xwiki.model.reference.DocumentReference> getDocuments()
        Returns:
        the list of documents to include in the PDF export; the PDF export job will render each of these documents to HTML and aggregate the results using the PDF template, printing the result to PDF in the end; the first document in the list is considered the main document and will be used to generate the cover page, table of contents, header and footer
      • setDocuments

        public void setDocuments​(List<org.xwiki.model.reference.DocumentReference> documents)
        Sets the list of documents to export as PDF.
        Parameters:
        documents - the list of documents to export as PDF
      • getTemplate

        public org.xwiki.model.reference.DocumentReference getTemplate()
        Returns:
        the PDF template reference, i.e. the document that controls what is displayed in the cover page, table of contents, header and footer, as well as the styles used when generating the PDF; the PDF template should have an object of type XWiki.PDFExport.TemplateClass
      • setTemplate

        public void setTemplate​(org.xwiki.model.reference.DocumentReference template)
        Sets the PDF template.
        Parameters:
        template - the PDF template to use
      • isWithCover

        public boolean isWithCover()
        Returns:
        whether to generate the cover page or not
      • setWithCover

        public void setWithCover​(boolean withCover)
        Sets whether to generate the cover page or not.
        Parameters:
        withCover - true to generate the cover page, false otherwise
      • isWithToc

        public boolean isWithToc()
        Returns:
        whether to generate the table of contents page or not
      • setWithToc

        public void setWithToc​(boolean withToc)
        Sets whether to generate the table of contents page or not.
        Parameters:
        withToc - true to generate the table of contents page, false otherwise
      • isWithHeader

        public boolean isWithHeader()
        Returns:
        whether to generate the page header or not
      • setWithHeader

        public void setWithHeader​(boolean withHeader)
        Sets whether to generate the page header or not.
        Parameters:
        withHeader - true to generate the page header, false otherwise
      • isWithFooter

        public boolean isWithFooter()
        Returns:
        whether to generate the page footer or not
      • setWithFooter

        public void setWithFooter​(boolean withFooter)
        Sets whether to generate the page footer or not.
        Parameters:
        withFooter - true to generate the page footer, false otherwise
      • isServerSide

        public boolean isServerSide()
        Returns:
        whether to generate the PDF file server-side, as a temporary resource (using a headless browser), or client-side using the user's browser
      • setServerSide

        public void setServerSide​(boolean serverSide)
        Sets whether to generate the PDF file server-side, as a temporary resource, or client-side.
        Parameters:
        serverSide - true to generate the PDF file server-side, false to let the users print the PDF file themselves
      • isWithTitle

        public boolean isWithTitle()
        Returns:
        whether to render the document title before the document content, using a level 1 heading; when not set it defaults to true if getDocuments() has multiple entries, otherwise to false, when a single document is rendered; note that this has an impact on the table of contents (when we generate one)
        Since:
        14.9RC1
      • setWithTitle

        public void setWithTitle​(Boolean withTitle)
        Sets whether to render the document title, before the document content, or not.
        Parameters:
        withTitle - true to include the document title, false to omit the document title, null to include the document title only when multiple documents are rendered
        Since:
        14.9RC1
      • getFileName

        public String getFileName()
        Returns:
        the file name proposed by the user agent when the user saves the generated PDF on their file system
        Since:
        14.9
      • setFileName

        public void setFileName​(String fileName)
        Sets the file name proposed by the user agent when the user saves the generated PDF on their file system.
        Parameters:
        fileName - the PDF file name
        Since:
        14.9
      • getBaseURL

        public URL getBaseURL()
        Returns:
        the base URL used to resolve relative URLs in the exported content
        Since:
        14.10.6, 15.1RC1
      • setBaseURL

        public void setBaseURL​(URL baseURL)
        Sets the base URL used to resolve relative URLs in the exported content. When the base URL is not set the relative URLs are by default resolved relative to the print preview URL which uses the export action and has a long query string that is specific to PDF export. This means relative URLs may be resolved using the export action and some strange query string if the base URL is not set.

        Note that the base URL is also used as the current request URL when rendering the documents server-side in the PDF export job.

        Parameters:
        baseURL - the base URL used to resolve URLs in the exported content
        Since:
        14.10.6, 15.1RC1