Hot to load document from Azure Blob Storage
Leave feedback
Following example demonstrates how to process documents fromΒ Azure Blob Storage.
publicstaticvoidRun(){stringblobName="sample.docx";stringoutputFilePath="SignedSample";using(Streamstream=DownloadFile(blobName)){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(stringblobName){CloudBlobContainercontainer=GetContainer();CloudBlobblob=container.GetBlobReference(blobName);MemoryStreammemoryStream=newMemoryStream();blob.DownloadToStream(memoryStream);memoryStream.Position=0;returnmemoryStream;}privatestaticCloudBlobContainerGetContainer(){stringaccountName="***";stringaccountKey="***";stringendpoint=$"https://{accountName}.blob.core.windows.net/";stringcontainerName="***";StorageCredentialsstorageCredentials=newStorageCredentials(accountName,accountKey);CloudStorageAccountcloudStorageAccount=newCloudStorageAccount(storageCredentials,newUri(endpoint),null,null,null);CloudBlobClientcloudBlobClient=cloudStorageAccount.CreateCloudBlobClient();CloudBlobContainercontainer=cloudBlobClient.GetContainerReference(containerName);container.CreateIfNotExists();returncontainer;}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in ourΒ GitHub examples: