Hello! I choose between different library to work with pdf and i wanna choose Aspose, but cannot find solution for sign document multiple times. I saw different topics at forum, but no worked solution.
Have been tried different version: 17.2.0 \ 17.6.0 \ 17.12.0 \ 21.7.0 \ 25.6.1 \ 25.7.0 result same = not worked.
Example code for reproduce:
public static void SignPdfWithCertificate(string inputFile, string outputFile, string certPath, string certPass, int startY)
{
using var pdfDocument = new Aspose.Pdf.Document(inputFile);
using var signature = new Aspose.Pdf.Facades.PdfFileSignature(pdfDocument);
var pkcs = new Aspose.Pdf.Forms.PKCS7(certPath, certPass); // Use PKCS7/PKCS7Detached objects
signature.Sign(1, true, new System.Drawing.Rectangle(100, startY, 400, 200), pkcs);
signature.Save((string)outputFile);
signature.Close();
}
public static void secondSign(string inputFile, string outputFile, string certPath, string certPass, int startY)
{
var pdFileSignature = new Aspose.Pdf.Facades.PdfFileSignature();
pdFileSignature.BindPdf(inputFile);
// Create a rectangle for 2nd signature location
System.Drawing.Rectangle rect2 = new System.Drawing.Rectangle(10, 10, 300, 50);
// Create 2nd signature object
var signature2 = new Aspose.Pdf.Forms.PKCS1(certPath, certPass); // PKCS#1
pdFileSignature.Sign(2, "I'm document reviewer", "test02@aspose-pdf-demo.local", "Aspose Pdf Demo, Australia", true, rect2, signature2);
// Save PDF document
pdFileSignature.Save(outputFile);
pdFileSignature.Close();
}