We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merge with signed files

I want to merge two pdf file, the first with a signature. The result is a pdf file without the link “Click to view this version” in the Signature tab in Adobe Acrobat Reader.
This means that I am not able to verify the signature of the revision.
Here a code example:

String pdf1Name = “C:\Temp\aspose\ticket\test.pdf.signed.pdf”;test.pdf.signed.pdf (79.8 KB)

String pdf2Name = “C:\Temp\aspose\ticket\docToAppend.pdf”;docToAppend.pdf (12.6 KB)

String pdfMergeName = “C:\Temp\aspose\ticket\merge.pdf”;merge.pdf (148.6 KB)

com.aspose.pdf.Document pdfDocument1 = new com.aspose.pdf.Document(pdf1Name);
com.aspose.pdf.Document pdfDocument2 = new com.aspose.pdf.Document(pdf2Name);
com.aspose.pdf.Document pdfDocumentMerge = new com.aspose.pdf.Document(pdf2Name);

PdfFileEditor pdfFileEditor = new PdfFileEditor();
pdfFileEditor.concatenate(new com.aspose.pdf.Document[]{pdfDocument1,pdfDocument2},pdfDocumentMerge);


How can I merge creating a version?

Thanks in advance,


Thank you for contacting support.

Would you please share a PDF document generated with Adobe Acrobat as expected output so that we may investigate further to help you out.

I am very sorry, but I am not able to generate the required file. But I can attach an image of a document that was delivered to me pdfExample.jpg (53.6 KB)
to better explain the desired behavior. As you can see from the image, the document is invalid but it is possible to obtain the previous version in order to check the validity of the document signature. In my case I have to add a simple page to a signed document with the possibility, however, to be able to see the original version of the document.

Thanks in advance,


Thank you for contacting support.

We would like to update you that Revision of a PDF document can be added to existing PDF document if you sign it after concatenation or modifications. Below code snippet is a demonstration how a signed revision can be added after modifications.

        Document pdfDocument1 = new Document(input);
        Document pdfDocumentMerge = new Document();
        ByteArrayOutputStream stream = new ByteArrayOutputStream();

        InputStream inputStream = null;
        byte[] bytes = stream.toByteArray();
        inputStream = new ByteArrayInputStream(bytes);            
        PKCS7Detached pkcs = new PKCS7Detached(certPath, certPwd);
        java.awt.Rectangle rect = new java.awt.Rectangle(100, 100, 200, 100);
        PdfFileSignature pdfSign = new PdfFileSignature();
        // Set signature appearance
        pdfSign.setSignatureAppearance(dataDir + "aspose-logo.jpg");
        pdfSign.sign(1, "", "Contact", "", true, rect, pkcs);

We hope this will be helpful. Please feel free to contact us if you need any further assistance.