Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Sep 19, 2023 3:33 am

Hello,
Is it possible to to digitally sign multiple times on same page pdf with only one digital signature?
Currently, I am using free version for dev environment. When I sign pdf again with same digital signature,
It show: "The document may contain signature already!"
How can I solve this issue?
Thanks

manhnd15
 
Posts: 1
Joined: Sat May 27, 2023 8:36 am

Tue Sep 19, 2023 8:56 am

Hi,

Thanks for your inquiry.
We are pleased to inform you that we have introduced a new interface that allows for multiple signatures on a single PDF document. You can now utilize the following code to achieve the desired functionality:

Code: Select all
            //Create PDF document
            PdfDocument document = new PdfDocument();

            //Load the PDF document
            document.LoadFromFile("sample.pdf");

            //Create X509Certificate2
            X509Certificate2 x509 = new X509Certificate2("test.pfx", "e-iceblue");


            //Create PdfOrdinarySignatureMaker
            PdfOrdinarySignatureMaker signatureMaker = new PdfOrdinarySignatureMaker(document, x509);

            //Set signature appearance
            PdfSignatureAppearance signatureAppearance = new PdfSignatureAppearance(signatureMaker.Signature);
            signatureAppearance.NameLabel = "Signer:";
            signatureAppearance.ContactInfoLabel = "ContactInfo:";
            signatureAppearance.LocationLabel = "Location:";
            signatureAppearance.ReasonLabel = "Reason:";

            //Set details for the signature1
            PdfSignature signature1 = signatureMaker.Signature;
            signature1.Name = "Tom";
            signature1.ContactInfo = "Tom Tang";
            signature1.Location = "China";
            signature1.Reason = "protect document data";

            //Add the first signature
            signatureMaker.MakeSignature("Signature1", document.Pages[0], 100, 300, 120, 70, signatureAppearance);


            //Set details for the signature2
            PdfSignature signature2 = signatureMaker.Signature;
            signature2.Name = "Bob";
            signature2.ContactInfo = "Bob Li";
            signature2.Location = "China";
            signature2.Reason = "protect document data";

            //Add the second signature
            signatureMaker.MakeSignature("Signature2", document.Pages[0], 400, 300, 120, 70, signatureAppearance);

            //Save the PDF document
            string outpdf = "output.pdf";
            document.SaveToFile(outpdf, FileFormat.PDF);

If you have any other questions, just feel free to contact us.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.PDF

cron