Set timeout for loading external resources contained by a document

The documents may contain external resources such as graphics that should be loaded during document rendering. 

Before v19.12 default timeout was 100 seconds which may slow down rendering in case a service that provides external resources is down.

In v19.12 we’ve set default timeout to 30 seconds and enabled users to specify the desired timeout in LoadOptions class.

This feature is supported for:

The following code snippet shows how to set a timeout for loading external resources:

        LoadOptions loadOptions = new LoadOptions();
        loadOptions.setResourceLoadingTimeout(5000);

        Viewer viewer = new Viewer("sample.doc", loadOptions);

        HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
        viewer.view(viewOptions);
        viewer.close();

More resources

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.