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 Apr 16, 2024 4:10 pm

We have Spire.Office licence, and we updated the last version (9.2.0 -> 9.3.1) But there is a problem with PDF Signature (multi signature):
Our PDFs has two signatures: one invisible and one with picture.
- With 9.2.0 version there was no problem, after the signaturing we saw both of them. (see pic "Signed (good)")
- But in the new version - we saw only one signature (there is no "invisible" signature in the PDF (see pic "Signed (error)")

Could you check it?
Thanks:
Attila Farkas

The source:
Code: Select all
            string input = @"c:\temp\teszt.pdf ";
            string pfx = @"c:\temp\pdf_poc.pfx";
            string icon = @"c:\temp\logo.png";
            string output = @"c:\\temp\\teszt_alairt.pdf ";
           
            Spire.Pdf.License.LicenseProvider.SetLicenseKey(RendszerBeallitasok.SpireLicence);
            PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(input);
            PdfCertificate cert = new PdfCertificate(pfx, "alma");

            // Visible signatue
            Spire.Pdf.Security.PdfSignature signature = new Spire.Pdf.Security.PdfSignature(doc, doc.Pages[0], cert, "signature0");
            signature.Bounds = new RectangleF(new PointF(90, 550), new SizeF(270, 90));

            //Load sign image source.
            signature.SignImageSource = PdfImage.FromFile(icon);

            //Set the dispay mode of graphics, if not set any, the default one will be applied
            signature.GraphicsMode = Spire.Pdf.Security.GraphicMode.SignImageAndSignDetail;
            signature.NameLabel = "Signer:";

            signature.Name = "Gary";

            signature.ContactInfoLabel = "ContactInfo:";
            signature.ContactInfo = signature.Certificate.GetNameInfo(System.Security.Cryptography.X509Certificates.X509NameType.SimpleName, true);

            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: ";
            signature.DistinguishedName = signature.Certificate.IssuerName.Name;

            signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill | PdfCertificationFlags.ForbidChanges;
            signature.Certificated = true;

            //Set fonts. if not set, default ones will be applied.
            signature.SignDetailsFont = new PdfFont(PdfFontFamily.TimesRoman, 10f);
            signature.SignNameFont = new PdfFont(PdfFontFamily.Courier, 15);

            //Set the sign image layout mode
            signature.SignImageLayout = Spire.Pdf.Security.SignImageLayout.None;

            // InVisible signatue
            PdfCertificate cert2 = new PdfCertificate(pfx, "alma");
            //Create a PdfSignature object
            Spire.Pdf.Security.PdfSignature signature2 = new Spire.Pdf.Security.PdfSignature(doc, doc.Pages[doc.Pages.Count - 1], cert, "MySignature");
            //Set the document permission to forbid changes but allow form fill
            signature2.DocumentPermissions = PdfCertificationFlags.ForbidChanges | PdfCertificationFlags.AllowFormFill;

            //Save pdf file.
            doc.SaveToFile(output);
            doc.Close();

dunaiceblue
 
Posts: 5
Joined: Wed Nov 16, 2022 7:20 am

Wed Apr 17, 2024 6:33 am

Hi,

Thanks for your inquiry.
I tested your scenario and reproduced your issue, and I logged it into our bug track system with ticket number SPIREPDF-6687. Once it is resolved. I’ll inform you in time.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 991
Joined: Tue Mar 08, 2022 2:02 am

Thu May 16, 2024 9:38 am

Hi,

Thanks for your patiently waiting.
We released the latest version of Spire.Pdf 10.5.5 including your fix with the ticket number SPIREPDF-6687, you can download it from the following link:
Website: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget: https://www.nuget.org/packages/Spire.PDF/10.5.5

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 991
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF