com.groupdocs.viewer.converter.options

Class PdfOptions



  • public class PdfOptions
    extends Object

    Provides options for rendering documents as PDF.

    • Constructor Detail

      • PdfOptions

        public PdfOptions()

        Initializes a new instance of the PdfOptions class.

    • Method Detail

      • setEnablePreciseRendering

        public void setEnablePreciseRendering(boolean value)

        Indicates whether the PDF document is rendered in a precise mode or not. The default value is false.

        Note:
        The precise rendering mode allows to keep maximum precision during positioning of glyphs on the page. When this option is enabled, it will degrade performance, but in certain cases will improve render result.

        Example:
        The following example demonstrates how to enable precise rendering.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getPdfOptions().setEnablePreciseRendering(true);
        
         String guid = "document.pdf";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Whether the PDF document is rendered in a precise mode or not.
      • setImageQuality

        public void setImageQuality(int value)

        Specifies output image quality for image resources when rendering as HTML. The default value is Low.

        Note:
        When rendering PDF documents which contains images it is possible to set desired image quality.

        Example:
        The following example demonstrates how to set best image quality.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getPdfOptions().setImageQuality(ImageQuality.High);
        
         String guid = "with-images.pdf";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Image quality for image resources when rendering as HTML.
      • setRenderLayersSeparately

        public void setRenderLayersSeparately(boolean value)

        Specifies whether PDF document layers have to be separated when rendering into HTML. The default value is false.

        Note:
        When rendering layered PDF documents into HTML, by default all layers are rendered as one. Enable layers separate rendering in order to group each PDF layer into separate elements, so that layers can be manipulated using Javascript.

        Example:
        The following example demonstrates how to enable layers separate rendering.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getPdfOptions().setRenderLayersSeparately(true);
        
         String guid = "multilayered.pdf";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Whether PDF document layers have to be separated when rendering into HTML.
      • setUseOriginalContentOrdering

        public void setUseOriginalContentOrdering(boolean value)

        Specifies content ordering mode when rendering into HTML. The default value is false.

        Note:
        When original content ordering is enabled, text and graphics are rendered into HTML according to z-order in original PDF document. This mode is preferable for rendering PDF documents with multi-layered layout. When original content ordering is not enabled text and graphics are rendered into HTML as a single layer.

        Example:
        The following example demonstrates how to enable original content ordering.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getPdfOptions().setUseOriginalContentOrdering(true);
        
         String guid = "multilayered.pdf";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Content ordering mode when rendering into HTML.