Interface PDFExportConfiguration


  • @Role
    @Unstable
    public interface PDFExportConfiguration
    PDF export configuration options.
    Since:
    14.4.2, 14.5
    Version:
    $Id: 432e0c132d8d54890f912b7a7d85e43b67d2b85a $
    • Field Detail

      • DEFAULT_XWIKI_HOST

        static final String DEFAULT_XWIKI_HOST
        The default host used by the headless Chrome to access XWiki.
        See Also:
        Constant Field Values
      • DEFAULT_XWIKI_URI

        static final String DEFAULT_XWIKI_URI
        The default URI used by the headless Chrome to access XWiki.
        See Also:
        Constant Field Values
    • Method Detail

      • getChromeDockerImage

        String getChromeDockerImage()
        Returns:
        the Docker image used to create the Docker container running the headless Chrome web browser; defaults to "zenika/alpine-chrome:latest"
      • getChromeDockerContainerName

        String getChromeDockerContainerName()
        Returns:
        the name of the Docker container running the headless Chrome web browser used to print web pages to PDF; defaults to "headless-chrome-pdf-printer"
      • getDockerNetwork

        String getDockerNetwork()
        Returns:
        the name or id of the Docker network to add the Chrome Docker container to; this is useful when XWiki itself runs inside a Docker container and you want to have the Chrome container in the same network in order for them to communicate, see getXWikiURI(); defaults to "bridge" the default Docker network
        See Also:
        getXWikiURI()
      • getChromeHost

        String getChromeHost()
        Returns:
        the host running the headless Chrome web browser, specified either by its name or by its IP address; this allows you to use a remote Chrome instance, running on a separate machine, rather than a Chrome instance running in a Docker container on the same machine; defaults to empty value, meaning that by default the PDF export is done using the Chrome instance running in the Docker container specified by getChromeDockerContainerName()
      • getChromeRemoteDebuggingPort

        int getChromeRemoteDebuggingPort()
        Returns:
        the port number used for communicating with the headless Chrome web browser running on the host specified by getChromeHost(); defaults to 9222
      • getChromeRemoteDebuggingTimeout

        default int getChromeRemoteDebuggingTimeout()
        Returns:
        the number of seconds to wait for the Chrome remote debugging service to responde before giving up
        Since:
        14.10.16, 15.5.2, 15.7
      • getXWikiURI

        URI getXWikiURI()
                 throws URISyntaxException
        Returns:
        the base URI that the headless Chrome browser should use to access the XWiki instance (i.e. the print preview page); the host (domain or IP address) is mandatory but the scheme and port number are optional (they default on the scheme and port number used when triggering the PDF export); defaults to "host.xwiki.internal" which means the host running the Docker daemon; if XWiki runs itself inside a Docker container then you should use the assigned network alias, provided both containers (XWiki and Chrome) are in the same Docker network, specified by getDockerNetwork();
        Throws:
        URISyntaxException - if the specified URI is not valid
        Since:
        14.10.15, 15.5.2, 15.7RC1
      • isXWikiURISpecified

        @Unstable
        default boolean isXWikiURISpecified()
        Returns:
        true if the XWiki URI is specified in the configuration, false if the default XWiki URI is used
        Since:
        14.10.22, 15.10.8, 16.2.0RC1
      • isServerSide

        default boolean isServerSide()
        Returns:
        true if the PDF export should be performed server-side, e.g. using a headless Chrome web browser running inside a Docker container, false if the user's web browser should be used instead; defaults to client-side PDF generation
        Since:
        14.4.3, 14.5.1, 14.6RC1
      • getTemplates

        default List<org.xwiki.model.reference.DocumentReference> getTemplates()
        Returns:
        the list of PDF export templates the user can choose from
        Since:
        14.9RC1
      • getPageReadyTimeout

        default int getPageReadyTimeout()
        Returns:
        the number of seconds to wait for the web page to be ready (for print) before timing out
        Since:
        14.9
      • getMaxContentSize

        default int getMaxContentSize()
        Returns:
        the maximum content size, in kilobytes (KB), an user is allowed to export to PDF; in order to compute the content size we sum the size of the HTML rendering for each of the XWiki documents included in the export; the size of external resources, such as images, style sheets, JavaScript code is not taken into account; 0 means no limit; defaults to 5MB
        Since:
        14.10
      • getThreadPoolSize

        default int getThreadPoolSize()
        Returns:
        the maximum number of PDF exports that can be executed in parallel (each PDF export needs a separate thread); defaults to 3
        Since:
        14.10
      • isReplacingFOP

        default boolean isReplacingFOP()
        Returns:
        whether to replace or not the old PDF export based on Apache Formatting Objects Processor (FOP)
        Since:
        14.10