Load document from Amazon S3 Storage
Leave feedback
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;
}
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Signature for .NET examples, plugins, and showcase
- GroupDocs.Signature for Java examples, plugins, and showcase
- Document Signature for .NET MVC UI Example
- Document Signature for .NET App WebForms UI Example
- Document Signature for Java App Dropwizard UI Example
- Document Signature for Java Spring UI Example
Along with full-featured .NET 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.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.