Using Aspose.Pdf in Azure

Hello,

I am attempting to use Aspose.Net in an Azure Web API to create and digitally sign PDFs dynamically. I have been able to create the PDFs and sign them when I run the Web API locally. However, I am unsure how I am going to sign the documents created in the method while the API is hosted in Azure, since I am not allowed to use URI locations for the certificate and image files needed for the digital signature.

Can you tell me if Aspose for .NET will support signing PDF documents while the code that does so is hosted in an Azure web service? Will the signature allow UNC paths?

Here is the code I'm using for the signature (this works locally):

The lines where I have "D:\SignatureFiles\" is where I need to be able to access a file in a "virtual" location - where I will most likely have a URI, but not a "local drive".

Aspose.Pdf.Generator.Image img = new Image();
img.ImageInfo.File = "~/Images/Sig_Logo.PNG";
img.ImageInfo.ImageFileType = ImageFileType.Png;

// Digital Signature
Aspose.Pdf.Document pDoc = new Aspose.Pdf.Document(pdfDoc);
PdfFileSignature pdfSig = new PdfFileSignature(pDoc);

System.Drawing.Rectangle rect = new System.Drawing.Rectangle(300, 300, (int)img.ImageWidth, (int)img.ImageHeight);

string imgPath = @"D:\SignatureFiles\Sig_Logo.PNG";
string certPath = @"D:\SignatureFiles\Sig1.p7c";

pdfSig.SignatureAppearance = imgPath;
PKCS7 sig = new PKCS7(certPath, "password");
pdfSig.Sign(1, "Validation", "Contact", "Bottom", true, rect, sig);

Thank you for your help!

Hi Theresa,


Thanks for using our API’s.

In order to sign the API’s in Azure environment, we recommend using Aspose.Pdf for Cloud API instead of using Aspose.Pdf for .NET. Please visit the following link for further details on Sign PDF Documents.

In the event of any further query, please feel free to contact.