I was trying to sign a big PDF file, and it throw an OutOfMemoryException. Does document load the whole file into memory? Is there a solution that could make it work on 32bit system?
Exception throws at signature.Save() step.
And my code is nearly the same as examples in Documents ( Digitally sign PDF file | Documentation (aspose.com))
Here is my code:
using (Document document = new Document(tempFile))
{
using (PdfFileSignature signature = new PdfFileSignature(document))
{
var pkcs = new PKCS7(certFile, password);
var rect = new System.Drawing.Rectangle(0, 0, Convert.ToInt32(document.Pages[1].PageInfo.Width), 100);
signature.Sign(1, reason, string.Empty, location, true, rect, pkcs);
signature.Save(outputFile);
}
}