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.

Mon Aug 13, 2018 1:24 pm

Hello,
Is it possible to to digitally sign each page of the pdf with same signature.

I am able to do that by looping each page and applying signature, but when i open the pdf it is showing atleast one signature is invalid.

when i open the signature panel only last signature is ticked greean and rest all are showing as error.

how can i solve this issue

vsk116
 
Posts: 5
Joined: Mon Aug 13, 2018 1:20 pm

Tue Aug 14, 2018 8:50 am

Hello,

Thanks for your inquiry.
Kindly note that the multiple-times signing requires the behavior of saving and reloading the document, also applying license is necessary. Below is my testing code, the version I used is Spire.PDF Pack(Hot Fix) Version:4.8.5. And our sales team just sent a temporary license (one month free) of Spire.PDF to your email. Please apply it (How to apply the License by license key) and test your case. If there is any question, welcome to write back.
Code: Select all
            //Apply license
            Spire.License.LicenseProvider.SetLicenseKey("license key");
            //Load pdf
            PdfDocument doc = new PdfDocument("sample.pdf");
            int num = doc.Pages.Count;
            MemoryStream stream = new MemoryStream();
            //Sign each page
            for (int i = 0; i < num; i++)
            {
                PdfCertificate digi = new PdfCertificate("gary.pfx", "e-iceblue");
                PdfSignature signature = new PdfSignature(doc, doc.Pages[i], digi, "demo");
                signature.Bounds = new RectangleF(new PointF(100, 100), new SizeF(500, 200));
                signature.DistinguishedName = "DN:";
                signature.NameLabel = "Digital Signed By:";
                signature.Name = "Ankush";
                signature.ContactInfo = "Lisa";
                signature.Date = DateTime.Now;
                signature.Certificated = false;
                signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill | PdfCertificationFlags.ForbidChanges;
                //save and reload
                doc.SaveToStream(stream);
                doc = new PdfDocument(stream);
            }
            //Save to result pdf
            doc.SaveToStream(stream, FileFormat.PDF);
            File.WriteAllBytes("result.pdf", stream.ToArray());


Thanks and Regards,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Aug 14, 2018 1:11 pm

Hello,

Thanks for the quick response.
Working fine by applying licence.

vsk116
 
Posts: 5
Joined: Mon Aug 13, 2018 1:20 pm

Wed Aug 15, 2018 1:02 am

Hello,

Thanks for your valuable feedback.
Just feel free to contact us if you need further assistance. Wish you all the best!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Wed Sep 18, 2019 7:38 am

I am having the same issue as I require multiple digital signature on my document as well
can I also get a temporary license key for development purpose? my client will buy the license once the code runs smoothly.
it currently keeps trowing System.ArgumentException: 'The document may contain signature already!'

sayan1995
 
Posts: 7
Joined: Wed Sep 18, 2019 7:35 am

Wed Sep 18, 2019 7:55 am

Hi,

Thanks for your inquiry.
Our sales team just sent a temporary license of Spire.PDF for .NET to your email. Please have a check.
As for the exception, please provide your input PDF and full code for testing.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Sep 18, 2019 8:44 am

Hi, Thanks for replying and license, but my intention is to digitally sign the same document in the same page multiple time by different certificates on different point of time. is that possible? if yes can you include a sample code?

sayan1995
 
Posts: 7
Joined: Wed Sep 18, 2019 7:35 am

Wed Sep 18, 2019 10:13 am

Hi,

Our Spire.PDF supports that. Please refer to following code:
Code: Select all
            PdfDocument doc = new PdfDocument(FilePath + "3pages.pdf");
            //Load the certificate
            String pfxPath1 = @"Demo.pfx";
            PdfCertificate digi1 = new PdfCertificate(pfxPath1, "e-iceblue");
            SignWithPages(doc, digi1, doc.Pages[0], new PointF(10,100), new SizeF(100, 100));
            MemoryStream stream = new MemoryStream();
            //save to file after one signature
            doc.SaveToStream(stream);

            //reload pdf file
            doc = new PdfDocument(stream);
            string pfxPath2 = "gary.pfx";
            PdfCertificate digi2 = new PdfCertificate(pfxPath2, "e-iceblue");
            SignWithPages(doc, digi2, doc.Pages[0],  new PointF(10,300),new SizeF(100,100));

            doc.SaveToFile("18942.pdf");

        public static void SignWithPages(PdfDocument doc, PdfCertificate cert, PdfPageBase page, PointF point, SizeF size )
        {
            PdfSignature signature = new PdfSignature(doc, page, cert, "signature");
            signature.Bounds = new RectangleF(point, size);
            signature.NameLabel = "Signer:";
            signature.Name = "Gary";
            signature.ContactInfoLabel = "ContactInfo:";
            signature.DateLabel = "Date:";
            signature.Date = DateTime.Now;
 
            signature.LocationInfoLabel = "Location:";
            signature.LocationInfo = "Chengdu";

            signature.ReasonLabel = "Reason: ";
            signature.Reason = "The certificate of this document";
            signature.DistinguishedNameLabel = "DN: ";
        }


Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Sep 18, 2019 10:43 am

Thanks. That worked fine.

sayan1995
 
Posts: 7
Joined: Wed Sep 18, 2019 7:35 am

Thu Sep 19, 2019 1:27 am

Hi,

Thanks for your feedback.
Any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Oct 21, 2019 7:40 am

Hello,
I am experiencing the same problem with multiple digital signature. May I get a temporary license of Spire.PDF for .NET for development and testing purpose?
It would really be life saving.

adas62728
 
Posts: 3
Joined: Mon Oct 21, 2019 7:36 am

Mon Oct 21, 2019 8:51 am

Hi,

Thanks for your inquiry.
Our sales team just sent you a one-month free license of Spire.PDF to help you remove the warning information. Please check and apply it to have a better evaluation on our product.
And here is a guide for you: https://www.e-iceblue.com/Tutorials/Licensing/Licensing.html

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Mon Oct 21, 2019 9:09 am

Thsnaks for the early reply and the license.

adas62728
 
Posts: 3
Joined: Mon Oct 21, 2019 7:36 am

Mon Oct 21, 2019 9:41 am

Hi,

Thanks for your reply.
Any question, welcome to contact us.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Tue Oct 22, 2019 11:19 am

Hi, It is working fine in my local machine while developing but when I am deploying the web application and then pasting the license file in bin folder it seems like the license is not working.

adas62728
 
Posts: 3
Joined: Mon Oct 21, 2019 7:36 am

Return to Spire.PDF

cron