Load from Amazon S3 Storage

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Viewer MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-viewer -- dnx GroupDocs.Viewer.Mcp --yes
Folders, licensing and more →
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);
}