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

Free Support Forum - aspose.com

Merge and Sign PDF files digitally in C# using Aspose.PDF for .NET - Signature becomes invalid


We have been using Aspose.PDF to merge PDF files. We have found that multiple signature invalid for merged PDF files.

We have the following flow:

Merge two PDF/A-1B files
Sign result file with first signature
Sign result file with second signature

And after step 3, the first signature (applied on the 2td step) become invalid.

NOTE 1: we use external tool to sign PDF/A file, however when we try to sign with Aspose, we still have this problem.
NOTE 2: It seems that problem not in signature, but in the created PDF/A-1B file. If converted file is opened and re-saved with Adobe - signing works correct.
NOTE 3: we are using Aspose.Pdf v19.11 and Aspose.Words v19.11
NOTE 4: perhabs similar to this issue (PDFNET-47442)

Code example:

using System.Collections.Generic;
using System.IO;
using Aspose.Pdf;
using Aspose.Pdf.Facades;

namespace TestMergeAsposeAndDoubleSigning
    class Program
        private static string PfxFileName = @"D:\pdfAIssue\cert.pfx";
        private static string CertificatePassword = "1q2w3e4r5t";

        static void Main()
            var files = new List<string>();

            var mergedFileName = "merged.pdf";
            var firstSign = "firstSign.pdf";
            var result = "result.pdf";
            Merge(files, mergedFileName);

            Sign(mergedFileName, firstSign);
            Sign(firstSign, result);
        private static void Merge(
            List<string> filesPath,
            string outputFilePath)
            var license = new License();

            Document outputDocument = null;

            foreach (var filePath in filesPath)
                if (outputDocument == null)
                    outputDocument = new Document();

                var inputDocument = new Document(filePath);


                new MemoryStream(),
                ConvertErrorAction.None /*GetErrorAction(parameters)*/);


        private static void Sign(string inputFilePath, string outputFilePath)
            var license = new License();

            using (PdfFileSignature pdfSign = new PdfFileSignature())
                pdfSign.SetCertificate(PfxFileName, CertificatePassword);
                pdfSign.Sign(1, "Signature Reason", "Contact", "Location", false, System.Drawing.Rectangle.Empty);

pdfaSigningIssue.zip (1.4 MB)


Can you please share source files along with generated result and environment details so that we may further investigate to help you out.


I have added files.
Enviroment: windows 10, x64



Thanks for contacting support.

I have observed your issue and like to inform that I have created ticket with ID PDFNET-47666 in our issue tracking system to investigate and resolve this issue as soon possible.

Hi, we recently updated our Aspose libraries to version 20.12.0. We are merging documents using the exact same method above that were signed by DocuSign. The signatures are being invalidated on the documents due to the merge. Is there an ETA on when ticket PDFNET-47666 will be resolved?


We are afraid that earlier logged ticket is not yet resolved due to other issue logged prior to it. However, we will surely inform you as soon as it is completely investigated and any news about its ETA is available. Please give us some time.

We apologize for the inconvenience.

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