Set timeout for loading external resources

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 each external resource to 500 milliseconds.

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

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

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