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(CreatePageStream createPageStream)
        Initializes new instance of HtmlViewOptions class for rendering into HTML with embedded resources.
        Parameters:
        createPageStream - The method that instantiates stream used to write output page data.
        Returns:
        New instance of HtmlViewOptions class for rendering into HTML with embedded resources.
      • forEmbeddedResources

        public static HtmlViewOptions forEmbeddedResources(CreatePageStream createPageStream,
                                           ReleasePageStream releasePageStream)
        Initializes new instance of HtmlViewOptions class for rendering into HTML with embedded resources.
        Parameters:
        createPageStream - The method that instantiates stream used to write output page data.
        releasePageStream - The method that releases stream created by method assigned to delegate that passed to createPageStream parameter.
        Returns:
        New instance of HtmlViewOptions class for rendering into HTML with embedded resources.
      • 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(CreatePageStream createPageStream,
                                           CreateResourceStream createResourceStream,
                                           CreateResourceUrl createResourceUrl)
        Initializes new instance of HtmlViewOptions class for rendering into HTML with external resources.
        Parameters:
        createPageStream - The method that instantiates stream used to write output page data.
        createResourceStream - The method that releases stream created by createPageStream method.
        createResourceUrl - The method that creates URL for HTML resource.
        Returns:
        New instance of HtmlViewOptions class for rendering into HTML with external resources.
      • 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.
      • getImageHeight

        public int getImageHeight()
        The height of an output image in pixels. (When converting single image to HTML only)
      • getImageMaxHeight

        public int getImageMaxHeight()
        Max height of an output image in pixels. (When converting single image to HTML only)
      • getImageMaxWidth

        public int getImageMaxWidth()
        Max width of an output image in pixels. (When converting single image to HTML only)
      • getImageWidth

        public int getImageWidth()
        The width of the output image in pixels. (When converting single image to HTML only)
      • 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.

      • isRenderToSinglePage

        public boolean isRenderToSinglePage()
      • 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.

      • setImageHeight

        public void setImageHeight(int imageHeight)
        The height of an output image in pixels. (When converting single image to HTML only)
      • setImageMaxHeight

        public void setImageMaxHeight(int imageMaxHeight)
        Max height of an output image in pixels. (When converting single image to HTML only)
      • setImageMaxWidth

        public void setImageMaxWidth(int imageMaxWidth)
        Max width of an output image in pixels. (When converting single image to HTML only)
      • setImageWidth

        public void setImageWidth(int imageWidth)
        The width of the output image in pixels. (When converting single image to HTML only)
      • 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.

      • setRenderToSinglePage

        public void setRenderToSinglePage(boolean renderSinglePage)
        Enables HTML content will be rendered to single page