com.groupdocs.viewer.handler

Class ViewerHandler<T extends Page>

    • Field Detail

      • cacheDataHandler

        protected ICacheDataHandler cacheDataHandler

        The cache data handler.

      • engineType

        protected int engineType

        Html or Image engine type

      • inputDataHandler

        protected IInputDataHandler inputDataHandler

        The input data handler.

      • viewerConfig

        protected ViewerConfig viewerConfig

        The viewer configuration.

    • Constructor Detail

      • ViewerHandler

        public ViewerHandler(ViewerConfig viewerConfig,
                     int engineType)

        Initializes a new instance of the ViewerHandler class.

        Parameters:
        viewerConfig - The viewer configuration.
        engineType - The engine type.
      • ViewerHandler

        public ViewerHandler(ViewerConfig viewerConfig,
                     int engineType,
                     com.groupdocs.foundation.utils.CultureInfo cultureInfo)

        Initializes a new instance of the ViewerHandler class.

        Parameters:
        viewerConfig - The viewer configuration.
        engineType - The engine type.
        cultureInfo - The culture.
      • ViewerHandler

        public ViewerHandler(ViewerConfig viewerConfig,
                     int engineType,
                     IFileStorage fileStorage,
                     com.groupdocs.foundation.utils.CultureInfo cultureInfo)
        Initializes a new instance of the ViewerHandler class.
        Parameters:
        viewerConfig - The viewer configuration.
        engineType - The engine type.
        fileStorage - The file storage.
      • ViewerHandler

        public ViewerHandler(ViewerConfig viewerConfig,
                     int engineType,
                     IInputDataHandler inputDataHandler,
                     ICacheDataHandler cacheDataHandler,
                     com.groupdocs.foundation.utils.CultureInfo cultureInfo)

        Initializes a new instance of the ViewerHandler class.

        Parameters:
        viewerConfig - The viewer configuration.
        engineType - The engine type.
        cultureInfo - The viewer culture.
        inputDataHandler - The input data handler.
        cacheDataHandler - The cache data handler.
        Throws:
        com.groupdocs.viewer.exception.ArgumentNullException - viewerConfig
    • Method Detail

      • clearCache

        public void clearCache()

        Clears all of the cache.

        Example:
        The following example demonstrates how to clear the cache.

         ViewerConfig config = new ViewerConfig();
         config.setEnableCaching(true);
         config.setCachePath("C:\storage\cachefiles\");
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         String guid = "C:\storage\document.doc";
        
         List<PageImage> imagePages = imageHandler.getPages(guid);
         imageHandler.clearCache();
         

      • clearCache

        public void clearCache(String guid)

        Clears cache of the specified document.

        Example:
        The following example demonstrates how to clear the cache of the specified document.

         ViewerConfig config = new ViewerConfig();
         String guid = "C:\storage\document.doc";
        
         imageHandler.clearCache(guid);
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt.
      • clearTempFiles

        public void clearTempFiles()

        Removes temporary files created during rendering.

      • getAttachmentName

        protected String getAttachmentName(AttachmentBase attachment)

        Gets the attachment name

        Parameters:
        attachment - The attachment
        Returns:
        Attachment name.
      • getCacheDataHandler

        protected ICacheDataHandler getCacheDataHandler()

        The cache data handler.

        Returns:
        The cache data handler.
      • getDocumentInfo

        public DocumentInfoContainer getDocumentInfo(InputStream fileStream)
                                              throws Exception

        Gets the document information.

        Note:
        Use this method to get document specific information, like created date, file size, number of pages and etc.

        Example:
        The following example demonstrates how to get document information.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         FileInputStream fileStream = new FileInputStream("C:\storage\aspose-logo.jpg");
         DocumentInfoContainer documentInfo = imageHandler.getDocumentInfo(fileStream);
         

        Parameters:
        fileStream - The file stream.
        Returns:
        The document information.
        Throws:
        Exception
      • getDocumentInfo

        public DocumentInfoContainer getDocumentInfo(InputStream fileStream,
                                            DocumentInfoOptions documentInfoOptions)
                                              throws Exception

        Gets the document information.

        Note:
        Use this method to get document specific information, like created date, file size, number of pages and etc.

        Example:
        The following example demonstrates how to get document information.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         FileInputStream fileStream = new FileInputStream("C:\storage\protected.pdf")
         DocumentInfoOptions options = new DocumentInfoOptions();
         options.setPassword("mypass");
        
         DocumentInfoContainer documentInfo = imageHandler.getDocumentInfo(fileStream, options);
         

        Parameters:
        fileStream - The file stream.
        documentInfoOptions - The document info options.
        Throws:
        Exception
      • getDocumentInfo

        public DocumentInfoContainer getDocumentInfo(InputStream fileStream,
                                            String fileName)
                                              throws Exception

        Gets the document information.

        Note:
        Use this method to get document specific information, like created date, file size, number of pages and etc. Passing file name along with the file Stream, in contract to passing just file Stream will result in reduced processing time, because file type detection operation won't be involved.

        Example:
        The following example demonstrates how to get document information.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         FileInputStream fileStream = new FileInputStream("C:\storage\aspose-logo.jpg");
         DocumentInfoContainer documentInfo = imageHandler.getDocumentInfo(fileStream, "aspose-logo.jpg");
         

        Parameters:
        fileStream - The file stream.
        fileName - The file name.
        Returns:
        The document information.
        Throws:
        Exception
      • getDocumentInfo

        public DocumentInfoContainer getDocumentInfo(InputStream fileStream,
                                            String fileName,
                                            DocumentInfoOptions documentInfoOptions)
                                              throws Exception

        Gets the document information.

        Note:
        Use this method to get document specific information, like created date, file size, number of pages and etc. Passing file name along with the file Stream, in contract to passing just file Stream will result in reduced processing time, because file type detection operation won't be involved.

        Example:
        The following example demonstrates how to get document information.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         FileInputStream fileStream = new FileInputStream("C:\storage\protected.pdf");
         DocumentInfoOptions options = new DocumentInfoOptions();
         options.setPassword("mypass");
        
         DocumentInfoContainer documentInfo = imageHandler.getDocumentInfo(fileStream, "protected.pdf", options);
         

        Parameters:
        fileStream - The file stream.
        fileName - The file name.
        documentInfoOptions - The document info options.
        Returns:
        The document information.
        Throws:
        Exception
      • getDocumentInfo

        public DocumentInfoContainer getDocumentInfo(String guid)
                                              throws Exception

        Gets the document information.

        Note:
        Use this method to get document specific information, like created date, file size, number of pages and etc.

        Example:
        The following example demonstrates how to get document information.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         String guid = "C:\storage\aspose-logo.jpg";
        
         DocumentInfoContainer documentInfo = imageHandler.getDocumentInfo(guid);
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt.
        Returns:
        The document information.
        Throws:
        Exception
      • getDocumentInfo

        public DocumentInfoContainer getDocumentInfo(String guid,
                                            DocumentInfoOptions documentInfoOptions)
                                              throws Exception

        Gets the document information.

        Note:
        Use this method to get document specific information, like created date, file size, number of pages and etc.

        Example:
        The following example demonstrates how to get document information.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
        
         DocumentInfoOptions options = new DocumentInfoOptions();
         options.setPassword("mypass");
         String guid = "C:\storage\protected.pdf";
        
         DocumentInfoContainer documentInfo = imageHandler.getDocumentInfo(guid, options);
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt.
        documentInfoOptions - The document info options.
        Throws:
        Exception
      • getDocumentInfo

        public DocumentInfoContainer getDocumentInfo(URI uri)
                                              throws Exception

        Gets the document information.

        Note:
        Use this method to get document specific information, like created date, file size, number of pages and etc.

        Example:
        The following example demonstrates how to get document information.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         Uri uri = new Uri("http://example.com/sample.doc");
        
         DocumentInfoContainer documentInfo = imageHandler.getDocumentInfo(uri);
         

        Parameters:
        uri - The URI.
        Returns:
        The document information.
        Throws:
        Exception
      • getDocumentInfo

        public DocumentInfoContainer getDocumentInfo(URI uri,
                                            DocumentInfoOptions documentInfoOptions)
                                              throws Exception

        Gets the document information.

        Note:
        Use this method to get document specific information, like created date, file size, number of pages and etc.

        Example:
        The following example demonstrates how to get document information.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
        
         DocumentInfoOptions options = new DocumentInfoOptions();
         options.getWordsOptions().setEncoding(Charset.forName(StandardCharsets.UTF_8.name()));
         Uri uri = new Uri("http://example.com/sample.doc");
        
         DocumentInfoContainer documentInfo = imageHandler.getDocumentInfo(uri, options);
         

        Parameters:
        uri - The URI.
        documentInfoOptions - The document info options.
        Returns:
        The document information.
        Throws:
        Exception
      • getDocumentInfo

        public DocumentInfoContainer getDocumentInfo(URI uri,
                                            WindowsAuthenticationCredential credential,
                                            DocumentInfoOptions documentInfoOptions)
                                              throws Exception

        Gets the document information.

        Note:
        Use this method to get document specific information, like created date, file size, number of pages and etc.

        Example:
        The following example demonstrates how to get document information.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
        
         DocumentInfoOptions options = new DocumentInfoOptions();
         options.getWordsOptions().setEncoding(Charset.forName(StandardCharsets.UTF_8.name()));
         WindowsAuthenticationCredential credentials = new WindowsAuthenticationCredential("user", "password");
         Uri uri = new Uri("http://example.com/sample.doc");
        
         DocumentInfoContainer documentInfo = imageHandler.getDocumentInfo(uri, credentials, options);
         

        Parameters:
        uri - The URI.
        credential - The credentials.
        documentInfoOptions - The document info options.
        Returns:
        The document information.
        Throws:
        Exception
      • getFile

        public FileContainer getFile(AttachmentBase attachment)
                              throws Exception

        Get attachment file.

        Note:
        NOTE

        Example:
        The following example demonstrates how to get original file represented by a FileContainer from the document attachment.

         ViewerConfig config = new ViewerConfig();
         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
         DocumentInfoContainer info = htmlHandler.getDocumentInfo("C:\storage\document-with-attachments.msg");
        
         for (AttachmentBase attachment : info.getAttachments()) {
           FileContainer container = htmlHandler.getFile(attachment);
           // use container.getStream() to work with a file.
         }
         

        Parameters:
        attachment - The attachment.
        Returns:
        The attachment file.
        Throws:
        Exception
      • getFile

        public FileContainer getFile(InputStream fileStream,
                            AttachmentBase attachment)
                              throws Exception

        Get attachment file using file stream.

        Note:
        NOTE

        Example:
        The following example demonstrates how to get original file represented by a FileContainer using a document stream and attachment descriptor.

         FileInputStream fileStream = new FileInputStream("C:\storage\document-with-attachments.msg")
         ViewerConfig config = new ViewerConfig();
         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
         DocumentInfoContainer info = htmlHandler.getDocumentInfo(fileStream);
        
         for (AttachmentBase attachment : info.getAttachments()) {
           FileContainer container = htmlHandler.getFile(fileStream, attachment);
           // use container.getStream() to work with a file.
         }
         

        Parameters:
        fileStream - The file stream.
        attachment - The attachment.
        Returns:
        Thr attachment file using file stream.
        Throws:
        Exception
      • getFile

        public FileContainer getFile(String guid)
                              throws Exception

        Get original file.

        Example:
        The following example demonstrates how to get original file represented by a FileContainer.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         String guid = "C:\storage\aspose-logo.jpg";
        
         FileContainer container = imageHandler.getFile(guid);
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt.
        Returns:
        The original file.
        Throws:
        Exception
      • getFileList

        public FileListContainer getFileList()

        Retrieves the list of files and directories from the root storage path.

        Note:
        Use isDirectory property of FileDescription objects to distinguish files from folders.

        Example:
        The following example demonstrates how to retrieve and loop through the list of files and directories for root storage path.

         ViewerConfig config = new ViewerConfig();
         config.setStoragePath("C:\storage");
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
        
         FileListContainer container = imageHandler.getFileList();
        
         for (FileDescription node : container.getFiles()) {
           // use list of FileDescription objects.
         }
         

        Returns:
        The container with list of files and directories.
      • getFileList

        public FileListContainer getFileList(FileListOptions fileListOptions)

        Retrieves the list of files and directories from the custom path.

        Note:
        Use isDirectory property of FileDescription objects to distinguish files from folders.

        Example:
        The following example demonstrates how to retrieve and loop through the list of files and directories for custom path with sorting and ordering.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         FileListOptions options = new FileListOptions("C:\storage", FileListSortBy.Name, FileListOrderBy.Ascending);
        
         FileListContainer container = imageHandler.getFileList(options);
        
         for (FileDescription node : container.getFiles()) {
           // use list of FileDescription objects.
         }
         

        Parameters:
        fileListOptions - The options which specify sorting and ordering.
        Returns:
        The container with list of files and directories.
      • getInputDataHandler

        protected IInputDataHandler getInputDataHandler()

        The input data handler.

        Returns:
        The input data handler.
      • getPages

        public List<T> getPages(AttachmentBase attachment,
                       RenderOptions renderOptions)
                                      throws Exception

        Get list of pages representations of the attachment using render options.

        Parameters:
        attachment - The attachment descriptor.
        renderOptions - The render options.
        Returns:
        List of converted pages.
        Throws:
        Exception - if any.
      • getPages

        public List<T> getPages(InputStream fileStream,
                       AttachmentBase attachment,
                       RenderOptions renderOptions)
                                      throws Exception

        Get list of pages representations of the attachment using render options.

        Parameters:
        fileStream - The file stream.
        attachment - The attachment descriptor.
        renderOptions - The render options.
        Returns:
        List of converted pages
        Throws:
        Exception - if any.
      • getPages

        public List<T> getPages(InputStream fileStream,
                       RenderOptions renderOptions)
                                      throws Exception

        Get list of pages HTML representations.

        Parameters:
        fileStream - The file stream.
        renderOptions - The render options.
        Returns:
        List of converted pages
        Throws:
        Exception - if any.
      • getPages

        public List<T> getPages(InputStream fileStream,
                       String fileName,
                       RenderOptions renderOptions)
                                      throws Exception

        Get list of pages representations from Stream using file name and render options.

        Parameters:
        fileStream - The file stream.
        fileName - The file name.
        renderOptions - The render options.
        Returns:
        List of converted pages
        Throws:
        Exception - if any.
      • getPages

        public List<T> getPages(String guid,
                       RenderOptions renderOptions)
                                      throws Exception

        Get list of pages representations from guid using render options.

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt.
        renderOptions - The render options.
        Returns:
        List of converted pages
        Throws:
        Exception
      • getPages

        public List<T> getPages(URI uri,
                       RenderOptions renderOptions)
                                      throws Exception

        Get list of pages representations from uri using render options.

        Parameters:
        uri - The URI.
        renderOptions - The render options.
        Returns:
        List of converted pages
        Throws:
        Exception - if any.
      • getPages

        public List<T> getPages(URI uri,
                       WindowsAuthenticationCredential credential,
                       RenderOptions renderOptions)
                                      throws Exception

        Get list of pages representations from uri with credentials using render options.

        Parameters:
        uri - The URI.
        credential - The credential.
        renderOptions - The render options.
        Returns:
        List of converted pages.
        Throws:
        Exception - if any.
      • getPdfFile

        public FileContainer getPdfFile(InputStream fileStream)
                                 throws Exception

        Gets the PDF file.

        Note:
        NOTE

        Example:
        The following example demonstrates how to render document as PDF.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         FileInputStream fileStream = new FileInputStream("document.doc");
         FileContainer container = imageHandler.getPdfFile(fileStream);
         // use container.getStream() to manipulate pdf representation of the input file.
         

        Parameters:
        fileStream - The file stream.
        Returns:
        The file container FileContainer
        Throws:
        Exception
      • getPdfFile

        public FileContainer getPdfFile(InputStream fileStream,
                               PdfFileOptions pdfFileOptions)
                                 throws Exception

        Gets the PDF file.

        Example:
        The following example demonstrates how to render document as PDF.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         PdfFileOptions pdfFileOptions = new PdfFileOptions();
         pdfFileOptions.setWatermark(new Watermark("For Test Only"));
        
         FileInputStream fileStream = new FileInputStream("document.doc");
        
         FileContainer container = imageHandler.getPdfFile(fileStream, pdfFileOptions);
         // use container.getStream() to manipulate pdf representation of the input file.
         

        Parameters:
        fileStream - The file stream.
        pdfFileOptions - The document info options.
        Returns:
        The file container FileContainer
        Throws:
        Exception
      • getPdfFile

        public FileContainer getPdfFile(InputStream fileStream,
                               String fileName)
                                 throws Exception

        Gets the PDF file.

        Note:
        Passing file name along with the file Stream, in contract to passing just file Stream will result in reduced processing time, because file type detection operation won't be involved.

        Example:
        The following example demonstrates how to render document as PDF.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         String fileName = "document.doc";
        
         FileInputStream fileStream = new FileInputStream(fileName);
         FileContainer container = imageHandler.getPdfFile(fileStream, fileName);
         // use container.getStream() to manipulate pdf representation of the input file.
         

        Parameters:
        fileStream - The file stream.
        fileName - The file name.
        Returns:
        The file container FileContainer
        Throws:
        Exception
      • getPdfFile

        public FileContainer getPdfFile(InputStream fileStream,
                               String fileName,
                               PdfFileOptions pdfFileOptions)
                                 throws Exception

        Gets the PDF file.

        Note:
        Passing file name along with the file Stream, in contract to passing just file Stream will result in reduced processing time, because file type detection operation won't be involved.

        Example:
        The following example demonstrates how to render document as PDF.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
        
         PdfFileOptions pdfFileOptions = new PdfFileOptions();
         pdfFileOptions.setWatermark(new Watermark("For Test Only"));
         String fileName = "document.doc";
        
         FileInputStream fileStream = new FileInputStream(fileName);
         FileContainer container = imageHandler.getPdfFile(fileStream, fileName, pdfFileOptions);
         // use container.getStream() to manipulate pdf representation of the input file.
         

        Parameters:
        fileStream - The file stream.
        fileName - The file name.
        pdfFileOptions - The document info options.
        Returns:
        The file container FileContainer
        Throws:
        Exception
      • getPdfFile

        public FileContainer getPdfFile(String guid)
                                 throws Exception

        Gets the PDF file.

        Example:
        The following example demonstrates how to render document as PDF.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         String guid = "C:\storage\document.doc";
        
         FileContainer container = imageHandler.getPdfFile(guid);
         // use container.getStream() to manipulate pdf representation of the input file.
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt.
        Returns:
        The file container FileContainer
        Throws:
        Exception
      • getPdfFile

        public FileContainer getPdfFile(String guid,
                               PdfFileOptions pdfFileOptions)
                                 throws Exception

        Gets the PDF file.

        Example:
        The following example demonstrates how to render document as PDF.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
        
         PdfFileOptions pdfFileOptions = new PdfFileOptions();
         pdfFileOptions.setWatermark(new Watermark("For Test Only"));
         String guid = "C:\storage\document.doc";
        
         FileContainer container = imageHandler.GetFile(guid);
         // use container.getStream() to manipulate pdf representation of the input file.
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt.
        pdfFileOptions - Pdf file options.
        Returns:
        The file container FileContainer
        Throws:
        Exception
      • getPdfFile

        public FileContainer getPdfFile(URI uri)
                                 throws Exception

        Gets the PDF file.

        Note:
        NOTE

        Example:
        The following example demonstrates how to render document as PDF.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         Uri uri = new Uri("http://example.com/sample.doc");
        
         FileContainer container = imageHandler.getPdfFile(uri);
         // use container.getStream() to manipulate pdf representation of the input file.
         

        Parameters:
        uri - The URI.
        Returns:
        The file container FileContainer
        Throws:
        Exception
      • getPdfFile

        public FileContainer getPdfFile(URI uri,
                               PdfFileOptions pdfFileOptions)
                                 throws Exception

        Gets the PDF file.

        Example:
        The following example demonstrates how to render document as PDF.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         Uri uri = new Uri("http://example.com/sample.doc");
         PdfFileOptions pdfFileOptions = new PdfFileOptions();
         pdfFileOptions.setWatermark(new Watermark("For Test Only"));
        
         FileContainer container = imageHandler.getPdfFile(uri, pdfFileOptions);
         // use container.getStream() to manipulate pdf representation of the input file.
         

        Parameters:
        uri - The URI.
        pdfFileOptions - The document info options.
        Returns:
        The file container FileContainer
        Throws:
        Exception
      • getPdfFile

        public FileContainer getPdfFile(URI uri,
                               WindowsAuthenticationCredential credential,
                               PdfFileOptions pdfFileOptions)
                                 throws Exception

        Gets the PDF file.

        Note:
        NOTE

        Example:
        The following example demonstrates how to render document as PDF.

         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
        
         WindowsAuthenticationCredential credentials = new WindowsAuthenticationCredential("user", "password");
         PdfFileOptions pdfFileOptions = new PdfFileOptions();
         pdfFileOptions.setWatermark(new Watermark("For Test Only"));
         Uri uri = new Uri("http://example.com/sample.doc");
        
         FileContainer container = imageHandler.getPdfFile(uri, credentials, pdfFileOptions);
         // use container.getStream() to manipulate pdf representation of the input file.
         

        Parameters:
        uri - The URI.
        credential - The credentials.
        pdfFileOptions - The document info options.
        Returns:
        The file container FileContainer
        Throws:
        Exception
      • getPrintableHtml

        public abstract PrintableHtmlContainer getPrintableHtml(String guid)
                                                         throws Exception

        Get document HTML for printing.

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt
        Returns:
        The document HTML for printing.
        Throws:
        Exception
      • getPrintableHtml

        public abstract PrintableHtmlContainer getPrintableHtml(String guid,
                                              PrintableHtmlOptions printableHtmlOptions)
                                                         throws Exception

        Get document HTML for print.

        Example:
        The following example demonstrates how to get printable HTML of the document.

         ViewerConfig config = new ViewerConfig();
         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
         String guid = "C:\storage\document.doc";
         PrintableHtmlOptions options = new PrintableHtmlOptions(guid);
        
         PrintableHtmlContainer container = htmlHandler.getPrintableHtml(options);
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt
        printableHtmlOptions - The printable HTML options.
        Returns:
        The document HTML for printing.
        Throws:
        Exception
      • getSupportedDocumentFormats

        public DocumentFormatsContainer getSupportedDocumentFormats()

        Gets supported document formats.

        Note:
        SupportedDocumentFormats property of DocumentFormatsContainer object, contains the list of document formats supported by GroupDocs.Viewer library.

        Example:
        The following example demonstrates how to get the list of supported document formats.

         ViewerConfig config = new ViewerConfig();
         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
        
         DocumentFormatsContainer supportedFormats = htmlHandler.GetSupportedDocumentFormats();
         

        Returns:
        Supported document formats.
      • getUnlicensedViewCountExceededPage

        public abstract T getUnlicensedViewCountExceededPage(RenderOptions renderOptions)
        Get unlicensed view count exceeded page.
        Parameters:
        renderOptions - The render options.
        Returns:
        Unlicensed view count exceeded page.
      • getViewerConfig

        protected ViewerConfig getViewerConfig()

        The viewer configuration.

        Returns:
        The viewer configuration.
      • reorderPage

        public void reorderPage(String guid,
                       ReorderPageOptions reorderPageOptions)

        Reorders the page.

        Note:
        To include reordered pages into the list of pages from GetPages method, pass RenderOptions object with Transformations property set to Transformations.Reorder as shown in example.

        Example:
        The following example demonstrates how to reorder document pages and get the list of pages including reordered pages.

         ViewerConfig config = new ViewerConfig();
         config.setEnableCaching(true);
         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
        
         String guid = "C:\storage\document.doc";
         ReorderPageOptions options = new ReorderPageOptions(1, 2);
         htmlHandler.reorderPage(guid, options);
         HtmlOptions htmlOptions = new HtmlOptions();
         htmlOptions.setTransformations(Transformation.Reorder)
        
         List<PageHtml> htmlPages = htmlHandler.getPages(guid, htmlOptions);
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt.
        reorderPageOptions - The reorder page options
      • reorderPage

        public void reorderPage(String guid,
                       ReorderPageOptions reorderPageOptions,
                       RenderOptions renderOptions)

        Reorders the page.

        Note:
        To include reordered pages into the list of pages from GetPages method, pass RenderOptions object with Transformations property set to Transformations.Reorder as shown in example.

        Example:
        The following example demonstrates how to reorder document pages and get the list of pages including reordered pages.

         ViewerConfig config = new ViewerConfig();
         config.setEnableCaching(true);
         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
        
         HtmlOptions htmlOptions = new HtmlOptions();
         htmlOptions.setShowHiddenPages(true);
        
         String guid = "C:\storage\document.pptx";
         ReorderPageOptions options = new ReorderPageOptions(1, 3);
         htmlHandler.reorderPage(guid, options, htmlOptions);
        
         htmlOptions.setTransformations(Transformation.Reorder);
         List<PageHtml> htmlPages = htmlHandler.getPages(guid, htmlOptions);
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt.
        reorderPageOptions - The reorder page options
        renderOptions - The render options.
      • rotatePage

        public void rotatePage(String guid,
                      RotatePageOptions rotatePageOptions)
                        throws Exception

        Rotates the page.

        Note:
        To get the rotated representation of initial document pass RenderOptions object with Transformations property set to Transformations.Rotate to GetPages method as shown in example.

        Example:
        The following example demonstrates how to rotate the 1st page of the document by 90 degree and get the list of pages including rotated pages.

         ViewerConfig config = new ViewerConfig();
         config.setEnableCaching(true);
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
        
         String guid = "C:\storage\document.doc";
         RotatePageOptions rotateOptions = new RotatePageOptions(1, 90);
         imageHandler.rotatePage(guid, rotateOptions);
         ImageOptions imageOptions = new ImageOptions();
         imageOptions.setTransformations(Transformation.Rotate);
        
         List<PageImage> imagePages = imageHandler.getPages(guid, imageOptions);
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt
        rotatePageOptions - The rotate page options.
        Throws:
        Exception
      • rotatePage

        public void rotatePage(String guid,
                      RotatePageOptions rotatePageOptions,
                      RenderOptions renderOptions)

        Rotates the page.

        Note:
        To get the rotated representation of initial document pass RenderOptions object with Transformations property set to Transformations.Rotate to GetPages method as shown in example.

        Example:
        The following example demonstrates how to rotate the 1st page of the document by 90 degree and get the list of pages including rotated pages.

         ViewerConfig config = new ViewerConfig();
         config.setEnableCaching(true);
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
        
         ImageOptions imageOptions = new ImageOptions();
         imageOptions.setShowHiddenPages(true);
        
         String guid = "C:\storage\document.pptx";
         RotatePageOptions rotateOptions = new RotatePageOptions(3, 90);
         imageHandler.rotatePage(guid, rotateOptions, imageOptions);
        
         imageOptions.setTransformations(Transformation.Rotate);
         List<PageImage> imagePages = imageHandler.getPages(guid, imageOptions);
         

        Parameters:
        guid - The file unique identifier, full path for local storage e.g. c:\\storage\\document.txt, relative path e.g document.txt, url e.g. http://site.com/document.txt
        rotatePageOptions - The rotate page options.
        renderOptions - The render options.