Load from Amazon S3 Storage

Note
Install the AWS Java SDK for Amazon S3 module to use the Amazon S3 client.

The following code snippet shows how to load a document from Amazon S3 Storage:

import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.GetObjectRequest;
import com.amazonaws.services.s3.model.S3Object;
import com.groupdocs.viewer.Viewer;
import com.groupdocs.viewer.options.HtmlViewOptions;
// ...

AmazonS3Client client = new AmazonS3Client();
GetObjectRequest request = new GetObjectRequest("my-bucket-name", "sample.docx");
S3Object response = client.getObject(request);

try (final InputStream inputStream = response.getObjectContent();
     Viewer viewer = new Viewer(inputStream)) {
    HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();

    viewer.view(viewOptions);
}