Specify file type when loading a document

You can specify the file type using LoadOptions.

The following code snippet shows how to specify the file type when loading a document:

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

// Specify the file type.
LoadOptions loadOptions = new LoadOptions(FileType.DOCX);

// Render a file using inputStream.
try (Viewer viewer = new Viewer(inputStream, loadOptions)) {
    HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
    viewer.view(viewOptions);
}