How to load document from Amazon S3 Storage
Leave feedback
Following example demonstrates how to process with documents from Amazon S3 Storage.
publicstaticvoidRun(){stringkey="sample.docx";stringoutputFilePath="SignedSample";using(Streamstream=DownloadFile(key)){using(Signaturesignature=newSignature(stream)){QrCodeSignOptionsoptions=newQrCodeSignOptions("JohnSmith"){EncodeType=QRCodeTypes.QR,Left=100,Top=100};// sign document to filesignature.Sign(outputFilePath,options);}}Console.WriteLine("\nSource document signed successfully.\nFile saved at "+outputFilePath);}publicstaticStreamDownloadFile(stringkey){AmazonS3Clientclient=newAmazonS3Client();stringbucketName="my-bucket";GetObjectRequestrequest=newGetObjectRequest{Key=key,BucketName=bucketName};using(GetObjectResponseresponse=client.GetObject(request)){MemoryStreamstream=newMemoryStream();response.ResponseStream.CopyTo(stream);stream.Position=0;returnstream;}}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in ourΒ GitHub examples: