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?
felaray:
Agree,tired of waiting. why can't we waste time on worthwhile somethings?
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.
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.