Document viewer - Image Viewer

Document viewer can operate in different rendering modes, HTML, Image and PDF (see Features Overview for more information). This article will describe on how to view documents in Image mode with Image Viewer.

Image Viewer provides PngViewOptions and JpgViewOptions  classes to set specific options for rendering the document into desired image format.

Here are the steps for rendering into image with GroupDocs.Viewer API:

Document Viewer - Image Viewer (PNG)

This example shows how to render each document page into PNG image.

    Viewer viewer = new Viewer("sample.docx");
    PngViewOptions viewOptions = new PngViewOptions();
    viewer.view(viewOptions);
    viewer.close();

Document Viewer - Image Viewer (JPG)

This example shows how to render each document page into JPG image.

    Viewer viewer = new Viewer("sample.docx");
    JpgViewOptions viewOptions= new JpgViewOptions();                  
    viewer.view(viewOptions);
    viewer.close();

More resources

Advanced Usage Topics

To learn more about document viewing features, please refer to the advanced usage section.

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured Java library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.