Load document 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.Signature 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-signature -- dnx GroupDocs.Signature.Mcp --yes
Folders, licensing and more →

Following example demonstrates how to process with documents from Amazon S3 Storage.

public static void run()
{
    String key = "sample.docx";
    try {
        InputStream stream = downloadFile(key);
 
        Signature signature = new Signature(stream);
 
        QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith");
        options.setEncodeType(QrCodeTypes.QR);
        options.setLeft(100);
        options.setTop(100);
 
        // sign document to file
        signature.sign("signedSample.docx", options);
 
        System.out.print("\nSource document signed successfully.\n" );
    }catch(Exception e){
        throw new GroupDocsSignatureException(e.getMessage());
    }
}
public static InputStream downloadFile(String key)
{
    AWSCredentials credentials = new BasicAWSCredentials(
            "<AWS accesskey>",
            "<AWS secretkey>"
    );
    AmazonS3 s3client = AmazonS3ClientBuilder.standard()
                                             .withCredentials(new AWSStaticCredentialsProvider(credentials))
                                             .withRegion(Regions.US_EAST_2)
                                             .build();
    String bucketName = "my-bucket";
 
    S3Object s3object = s3client.getObject(bucketName, key);
    S3ObjectInputStream inputStream = s3object.getObjectContent();
    return inputStream;
}

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 eSign PDF, Word, Excel, PowerPoint documents with free to use online GroupDocs Signature App.