Load from stream

You can load a document from a stream without saving it as a file on a disk. You can use this feature to load a document from different sources like a URL, FTP, and so on.

To load a document from a stream, follow these steps:

  1. Create document stream in any way you need.
  2. Call the Viewer class constructor specifying the created stream as an argument.

The following code snippet shows how to load a document from a stream:

import com.groupdocs.viewer.Viewer;
import com.groupdocs.viewer.options.HtmlViewOptions;
// ...

try (Viewer viewer = new Viewer(inputStream)) {
    HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();

Please refer to the following pages for examples: