Hello,
Hi Piui, thanks for contacting support and sorry for the delayed response.
In case you want to place several signatures, you must use the approach specified below.
- Add empty signatures using DOM (as much as needed).
- Place signatures’ values in empty signatures using facade PdfFileSignature, each Sign/Save adds one new signature.
[C#]
Document doc = new Document(@"input.pdf");
// place empty signatures
SignatureField s1 = new SignatureField(doc.Pages[1], new Rectangle(200, 200, 300, 100));
SignatureField s2 = new SignatureField(doc.Pages[2], new Rectangle(200, 200, 300, 100));
doc.Form.Add(s1);
doc.Form.Add(s2);
doc.Save(@"presign_output.pdf");
// create PdfFileSignature object and bind input and output PDF files
PdfFileSignature pdfSign = new PdfFileSignature(@"presign_output.pdf", @"sign_output.pdf");
// create any of the three signature types
PKCS1 signature1 = new PKCS1(@"test1.pfx", "test1");
signature1.Reason = "Signature Reason";
signature1.ContactInfo = "Contact";
signature1.Location = "Location";
PKCS1 signature2 = new PKCS1(@"test1.pfx", "test1");
signature2.Reason = "Signature Reason";
signature2.ContactInfo = "Contact";
signature2.Location = "Location";
// place first signature
pdfSign.Sign(s1.PartialName, signature1);
pdfSign.Save();
// place second signature
pdfSign = new PdfFileSignature(@"sign_output.pdf", @"sign_output.pdf");
pdfSign.Sign(s2.PartialName, signature2);
pdfSign.Save();
Another approach can be to use only PdfFileSignature in order to place several signatures. However, you need to create a new PdfFileSignature after each signing. See explanations in the previous comment.
[C#]
// create PdfFileSignature object and bind input and output PDF files
PdfFileSignature pdfSign = new PdfFileSignature(@"input.pdf", @"sign_output2.pdf");
// create a rectangle for signature location
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 100, 200, 100);
// create any of the three signature types
PKCS1 signature = new PKCS1(@"test1.pfx", "test1");
PKCS1 signature2 = new PKCS1(@"test1.pfx", "test1");
pdfSign.Sign(1, "Signature Reason", "Contact", "Location", true, rect, signature);
rect = new System.Drawing.Rectangle(200, 200, 300, 200);
// save output PDF file
pdfSign.Save();
pdfSign.Close();
pdfSign = new PdfFileSignature(@"sign_output2.pdf", @"sign_output2.pdf");
pdfSign.Sign(2, "Signature Reason", "Contact", "Location", true, rect, signature2);
// save output PDF file
pdfSign.Save();
If you still face any issue, please share your input PDF and signature files, so that we can further look into this matter.
Thanks for your response, but when i do sign with two signature it shows that the file has been altered since the signing.
Hi Pius,
Hello,
Hi Pius,
hi, i have same issue. any idea?
Hi there,
Thanks for your interest in Aspose. As shared here in your another similar post, the “Signature validity is unknown” warning relates to your signature certificate. Please check this thread of Adobe support forum for more details.
Please feel free to contact us for any further assistance.
Best Regards,
The issues you have found earlier (filed as PDFNET-40288) have been fixed in Aspose.PDF for .NET 21.7.