Free Support Forum - aspose.com

Bug on PdfFileEditor.Concatenate

Hello,


I just tried PdfFileEditor.Concatenate, it can concatenate the different pdfs, however, when I added digial signature, it said the digial signature is invalid. I suspect the merge leave some metadata, so, it cause this issue, below is the code:

pdfEditor.Concatenate(files, output);
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(output);
doc.Save(output);

However, if I do the same thing with appending pdf, then there is no problem with adding digial signature on merged file, below is the code:

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(files[0]);
for(int i=1;i<files.Length;i++)
{
Aspose.Pdf.Document doc1 = new Aspose.Pdf.Document(files[i]);
doc.Pages.Add(doc1.Pages);
}
doc.Save(output);



Hi There,


Thanks for contacting support.

I have tried concatenating two PDF documents using new DOM (Document Object Model) approach and then digitally sign the generated document. I was unable to observe any issue in signing the generated document digitally. Please note that it is recommended to use new DOM approach. Please check the following code snippet to concatenate documents.

Document pdfDocument1 = new Document(dataDir + “input.pdf”);<o:p></o:p>

Document pdfDocument2 = new Document(dataDir + "input2.pdf");

pdfDocument1.Pages.Add(pdfDocument2.Pages);

pdfDocument1.Save(dataDir + "ConcatenatedFile_out.pdf");


You may check "Concatenate PDF Files" section in the API documentation regarding new approach. Please try using above code to concatenate PDF Files and then sign them digitally. In case if you still face any issue please share your input file(s) so that we can try to reproduce the issue in our environment. We are sorry for the inconvenience.


Best Regards,