com.groupdocs.viewer.options

Class HtmlViewOptions



  • public class HtmlViewOptions
    extends ViewOptions

    Provides options for rendering documents into HTML format.

    • Method Detail

      • forEmbeddedResources

        public static HtmlViewOptions forEmbeddedResources(PageStreamFactory pageStreamFactory)

        Initializes new instance of HtmlViewOptions class for rendering into HTML with embedded resources.

        Parameters:
        pageStreamFactory - The factory which implements methods for creating and releasing output page stream.
        Returns:
        New instance of HtmlViewOptions class for rendering into HTML with embedded resources.
        Throws:
        IllegalArgumentException - Thrown when pageStreamFactory is null.
      • forEmbeddedResources

        public static HtmlViewOptions forEmbeddedResources(String filePathFormat)

        Initializes new instance of HtmlViewOptions class.

        Parameters:
        filePathFormat - The file path format e.g. 'page_{0}.html'.
        Throws:
        IllegalArgumentException - Thrown when filePathFormat is null or empty.
      • forExternalResources

        public static HtmlViewOptions forExternalResources()

        Initializes new instance of HtmlViewOptions class.


        This constructor initializes new instance of HtmlViewOptions
        • - with "p_{0}.html" as file path format for the output HTML files;
        • - with "p_{0}_{1}" as file path format for the output HTML-resource files;
        • - with "p_{0}_{1}" as URL format for HTML-resources;
        The output files will be placed into current working directory of the application.
      • forExternalResources

        public static HtmlViewOptions forExternalResources(PageStreamFactory pageStreamFactory,
                                           ResourceStreamFactory resourceStreamFactory)

        Initializes new instance of HtmlViewOptions class for rendering into HTML with external resources.

        Parameters:
        pageStreamFactory - The factory which implements methods for creating and releasing output page stream.
        resourceStreamFactory - The factory which implements methods that are required for creating resource URL, instantiating and releasing output HTML resource stream.
        Returns:
        New instance of HtmlViewOptions class for rendering into HTML with external resources.
        Throws:
        IllegalArgumentException - Thrown when pageStreamFactory is null.
        IllegalArgumentException - Thrown when resourceStreamFactory is null.
      • forExternalResources

        public static HtmlViewOptions forExternalResources(String filePathFormat,
                                           String resourceFilePathFormat,
                                           String resourceUrlFormat)

        Initializes new instance of HtmlViewOptions class.

        Parameters:
        filePathFormat - The file path format e.g. 'page_{0}.html'.
        resourceFilePathFormat - The resource file path format e.g. 'page_{0}/resource_{1}'.
        resourceUrlFormat - The resource URL format e.g. 'page_{0}/resource_{1}'.
        Throws:
        IllegalArgumentException - Thrown when filePathFormat is null or empty.
        IllegalArgumentException - Thrown when resourceFilePathFormat is null or empty.
        IllegalArgumentException - Thrown when resourceUrlFormat is null or empty.
      • getFontsToExclude

        public final List<String> getFontsToExclude()

        The list of font names, to exclude from HTML document.


        This option is supported for presentations only. The fonts that are added into HTML document improve stability of the output view, at the same time they increase the size of the rendering result. This option, lets you find compromise, between stability and output size. Include the font names that are popular and installed into most systems.
        Please note, this property is active only when ExcludeFonts(isExcludeFonts()/setExcludeFonts(boolean)) options is disabled.
      • isEmbedResources

        public final boolean isEmbedResources()
      • isExcludeFonts

        public final boolean isExcludeFonts()

        When enabled prevents adding any fonts into HTML document.

      • isExternalResources

        public final boolean isExternalResources()
      • isForPrinting

        public final boolean isForPrinting()

        Indicates whether to optimize output HTML for printing.

      • isMinify

        public final boolean isMinify()

        Enables HTML content and HTML resources minification.

      • isRenderResponsive

        public final boolean isRenderResponsive()

        Enables responsive rendering; Responsive web-pages render well on a devices with different screen size.

      • setExcludeFonts

        public final void setExcludeFonts(boolean value)

        When enabled prevents adding any fonts into HTML document.

      • setFontsToExclude

        public final void setFontsToExclude(List<String> value)

        The list of font names, to exclude from HTML document.


        This option is supported for presentations only. The fonts that are added into HTML document improve stability of the output view, at the same time they increase the size of the rendering result. This option, lets you find compromise, between stability and output size. Include the font names that are popular and installed into most systems. Please note, this property is active only when ExcludeFonts(isExcludeFonts()/setExcludeFonts(boolean)) options is disabled.
      • setForPrinting

        public final void setForPrinting(boolean value)

        Indicates whether to optimize output HTML for printing.

      • setMinify

        public final void setMinify(boolean value)

        Enables HTML content and HTML resources minification.

      • setRenderResponsive

        public final void setRenderResponsive(boolean value)

        Enables responsive rendering; Responsive web-pages render well on a devices with different screen size.