Sign a PDF file using multiple signatures

Hi Darius,

bss:
Hello,

1st inquiry on this issue was recorded on 2016.03.10.... thats 6 months from now... We just found same issue, that was reported way way back in time.
The main reason for our company in making decision to renew Aspose licence was your company claims that you support digital signatures and pdf-a formats and here we see what? 6 months in waiting and ZERO actions from devs?
It may look like small annoyance for you, but for companies that develop software for EU countries and decided to choose your components to do their tasks its much much more than that, unfortunately... for us.
Where else we should start exposing this issue so your company development department would start changing their opinion on seriousness of this bug?


Thanks for your feedback. In reference of the initial post(2016-03-10) of the thread, we were unable to replicate the issue with customer document. However in reference to your reported issue, we have recorded your concern and raised its issue priority to "High". Now our product team will schedule its investigation on priority and we will share further information accordingly.

Thanks for your patience and cooperation.

Best Regards,
Hi Felaray.

felaray:
Agree,tired of waiting. why can't we waste time on worthwhile somethings?


We are sorry for your inconvenience. Please note product team schedule the issues' investigation and resolution on first come first serve basis and impact on the API in terms of changes/restructuring. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Furthermore, issues varies from case to case. In your case the multiple signatures are reflecting fine in Adobe Acrobat Pro XI but Adobe Acrobat/Reader DC invalidates the signature. Anyhow, we have raised your issue priority and requested our team to complete the investigation and share an ETA/update at their earliest. We will notify you as soon as we get a feedback.

Best Regards,

@bss

Thanks for your patience.

Our product team has further investigated the logged issue and as per their investigation results, the problem that multiple signing doesn’t work with PDF/A documents occurs due to sign functionality, which changes internal document structure and these changes can affect PDF/A compliance.

So to avoid these side effects, it is necessary to convert document only after it was signed. If document was PDF/A originally, it must be converted into the same PDF/A format again after multiple signatures. Document instance must be created from saved file cause operation signature.Save() violates some PDF/A requirements.

So process to get PDF/A document with multiple signatures divided on some steps:

1. Sign document and save signed version on disk.
2. Create new document from saved file.
3. Repeat steps 1-2 with desired number of times
4. Convert new document into desired(or the same if document was PDF/A originally) PDF/A format
5. Save converted document.

Following code snippet produces correct PDF/A document with 2 signatures:

PdfFormat format = PdfFormat.PDF_A_2B;
Document doc = new Document("Test20.pdf");

string pfxFile = "pfx.pfx";
string pfxPass = "546573743230";
var signaturePKCS1 = new PKCS1(pfxFile, pfxPass);
string docName = "";      
//Signing document 2 times
for (var i = 1; i <= 2; i++)
{
 var signature = new Aspose.Pdf.Facades.PdfFileSignature(doc);  
 var rect = new System.Drawing.Rectangle(100, 50*i, 250, 50);
 signature.Sign(1, "Signature " + i + " Reason", "Contact " + i, "Location " + i, true, rect, signaturePKCS1);
 docName = "Test20" + "_" + i + ".pdf";
 signature.Save(docName);
 doc = new Document(docName);
 System.Threading.Thread.Sleep(1000);
}
//Convert document and save final version
doc.Convert("ConversionLog.xml, format,                                        
ConvertErrorAction.Delete);
doc.Save(docName);

Please download latest version Aspose.Pdf for .NET 17.9 and in case you face any issue, please feel free to let us know.

1 Like

The issues you have found earlier (filed as PDFNET-41446) have been fixed in Aspose.PDF for .NET 21.8.

The issues you have found earlier (filed as PDFNET-38630) have been fixed in Aspose.PDF for .NET 21.11.