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.

Wed Oct 23, 2019 1:21 am

Hi,

Thanks for your inquiry.
I firstly suggest you try to apply your license by license key (How to apply license by license key) in web application, since the other methods would cause the unrecognition of the license file because of the lack of permission or other reasons in some cases.

Best wishes,
Amber
E-iceblue support team
User avatar

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

Wed Oct 23, 2019 8:28 am

Hi,
I am also developing a web application where I need digital signature on each page of the pdf document. May I get a temporary license for development and test purposes?

nathk5148
 
Posts: 1
Joined: Wed Oct 23, 2019 8:26 am

Wed Oct 23, 2019 9:27 am

Hi,

Thanks for your inquiry.
We just sent a temporary license of Spire.PDF for you via email. Please have a check and refer to following guide to apply the license: https://www.e-iceblue.com/Tutorials/Lic ... nsing.html

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Tue Oct 29, 2019 6:25 am

Hi,

Did you get the temporary license? Has your issue been resolved?

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Wed Oct 28, 2020 12:29 pm

I am facing the same issue. I have added the trial license key from the license file. I have to add one digital signature on multiple pages of the pdf file.
I have added a digital signature on each page of the pdf but when I open the pdf file it gives me an error like the attached screenshot.
Also, I have tried multiple ways but still, I am getting error as "Signature Invalid, document altered". in this pdf only the last sign gets a valid signature, and remaining all other gets invalid.
Here is my code:-

Spire.License.LicenseProvider.SetLicenseKey("hIcUAQC31x1UZ5MB2N5VWWmr2FU/T+GIE2gY92ZqC4Y7iHiUuRemaFvaXlTGOvc8MJAaGUawQyLmtc9/TLzSJ/eV7t8wZg61kRZs38ZU94EjTGYeNvOY9lPLG7o9viDU3bR8z290sO6j+J5sPyECEMgEcDIMxiWoYGiDlAQCxcl+e5t07ohhC8kaK9rSG7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UcBQn5mkq/mLcZW1lAz+o2LgpnrLWxHCmlvfJGH1Uy61qXAYpPUS9UgydpNAKqPE4I2DJ5xAZXQqmBSCgmWgqtP+R9ePx6zlJnk22+luWibVIoGeGEhjrlwjLlSpT+xHEigNaDV4OB3ER1uC9hDJoboj+KzBT3wP8tjU35Llz2hvDZHMQbSg47Bnh+yC5uCG/Y6FIk3sJCK25sYGdeFbJRaeShpiLurHO1Z7/i4mMYQckpP9iQ==");
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(inputFileName);
// PdfCertificate cert = new PdfCertificate(digitalID);
//cert.Import(scollection);
int PageCount = doc.Pages.Count;
MemoryStream ms = new MemoryStream();

for (int x = 0; x < PageCount; x++)
{

PdfCertificate cert = new Spire.Pdf.Security.PdfCertificate(digitalID);
var signature = new PdfSignature(doc, doc.Pages[x], cert, "DigitalSignature1");
signature.Bounds = new RectangleF(new PointF(380, 740), new SizeF(230, 80));
signature.ContactInfo = "DigitalSignature1";
signature.IsTag = true;
signature.Name = "KARAN";
signature.DigitalSignerLable = "Digitally signed by ";
signature.DigitalSigner = "Karan Gophane";

signature.LocationInfoLabel = "Location:";
signature.LocationInfo = "PUNE";

signature.ReasonLabel = "Reason: ";
signature.Reason = "AUTHORISED";

signature.DateLabel = "Date: ";
signature.Date = DateTime.Now.Date;
signature.Certificated = false;
signature.SignInfoFont.Add(SignInfoType.SignInformation, new PdfFont(PdfFontFamily.TimesRoman, 8f, PdfFontStyle.Regular));

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


doc.SaveToStream(ms, FileFormat.PDF);
doc = new PdfDocument(ms);
doc.LoadFromStream(ms);


}

doc.SaveToStream(ms, FileFormat.PDF);
File.WriteAllBytes(outputFileName, ms.ToArray());

karangophane
 
Posts: 7
Joined: Fri Oct 23, 2020 4:37 am

Thu Oct 29, 2020 8:49 am

Hi karangophane,

Thanks for your inquiry.
I tested your case with the latest Spire.PDF Pack(Hot Fix) Version:6.10.9, but did not reproduce your issue. Here I uploaded my testing project. you can run it directly.

To help us further investigate your issue, please provide us with following information.
1) Your source PDF file, your certificate and the password.
2) The OS information and Region setting (e.g. Windows 7, 64bit, China/Chinese).
3) The project target framework (e.g. .NET Framework 4.5).
You can send them to us ([email protected]) via email. Thanks in advance for your assistance.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Thu Oct 29, 2020 12:02 pm

Hello,

Thanks for your reply.

It's working fine.

I am using a smartcard (USB) for certificate details.
Is there any issue with this? because you used the .pfx file in your code and I am using a smartcard(USB).
Any method or way to export the .pfx file from the smartcard?
Is there any other way to read data from a smartcard(USB) please let me know.

karangophane
 
Posts: 7
Joined: Fri Oct 23, 2020 4:37 am

Fri Oct 30, 2020 9:20 am

Hi karangophane,

Thank you for your response.
Regarding reading certificate details from the smartcard (USB), below is the corresponding code for your reference. And I did an initial test with your PDF file (that you provided in another post), I did find the signatures of the generated PDF are invalid. I have posted this issue to our Dev team with the ticket SPIREPDF-3731 for further investigation. If there is any update, we will let you know.
Sorry for the inconvenience caused.

Code: Select all
            X509Store store = new X509Store(StoreLocation.CurrentUser);
            store.Open(OpenFlags.ReadOnly);
            //Find the certificate based on the information of the certificate stored in the USB
            X509Certificate2Collection certs = store.Certificates.Find(X509FindType.FindByThumbprint, "F9B500AD95CDA70CD5157C3A1DF8C35049C3BEF0", false);
            X509Certificate2 cert = certs[0];
            PdfCertificate pdfcert = new PdfCertificate(cert);


Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Mon Jan 10, 2022 3:26 am

Hello,

Thanks for your patience!

Glad to inform you that we just released Spire.PDF Pack Version:8.1 which fixes the issue of SPIREPDF-3731.

Please download the fix version from the following links and refer to the following code to test.

Website link:https://www.e-iceblue.com/Download/download-pdf-for-net-now.html
Nuget link: https://www.nuget.org/packages/Spire.PDF/8.1.0

Code: Select all
        public void Bug_3731_ToPdf()
        {
            TestUtil.LicenseKey();
            String inputFile = @"../../../TestData/Pdf/Bug_3731.pdf";
            String outputFile = @"../../../ResultFiles/Pdf/Bug_3731.pdf";
            String inputFile_Pfx = @"../../../TestData/Pfx/gary.pfx";

            PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(inputFile);
            X509Certificate2 x509 = new X509Certificate2(inputFile_Pfx, "e-iceblue");
            PdfOrdinarySignatureMaker signatureMaker = new PdfOrdinarySignatureMaker(doc, x509);
            IPdfSignatureAppearance signatureAppearance = new PdfCustomSignatureAppearanc();

            for (int i = 0; i < doc.Pages.Count; i++)
            {
                signatureMaker.MakeSignature("signName_" + (i + 1), doc.Pages[i], 100, 100, 250, 200, signatureAppearance);
            }
            doc.SaveToFile(outputFile, FileFormat.PDF);
            doc.Close();

            #region check data
            string baseLineFile = @"../../../BaseLineFile/Pdf/Bug_3731.pdf";
            Assert.IsTrue(CompareFile.Compare(baseLineFile, outputFile));
            #endregion
        }
        public class PdfCustomSignatureAppearanc : IPdfSignatureAppearance
        {
            public void Generate(PdfCanvas g)

            {
                float x = 2;
                float y = 2;
                float fontSize = 10;
                //PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("arial", 14), true);
                PdfFontBase font = new PdfFont(PdfFontFamily.Symbol, 14);
                float lineHeight = fontSize; g.DrawString("AAAAAAAAAAA", font, PdfBrushes.Red, new PointF(0, 0));
            }
        }


Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Nov 16, 2022 5:23 am

I have same issue on java.
MemoryStream ms = new MemoryStream();
not working in java
does anyone help ???

prashant1689
 
Posts: 2
Joined: Mon Nov 14, 2022 5:50 am

Wed Nov 16, 2022 7:22 am

Hello,

Thanks for your inquiry.
To help us reproduce your issue and work out a solution for you, please offer the following message, thanks for your assistance in advance.

1) Your input PDF document, you can attach here or send it to us via email ([email protected]).
2) Your full test code that can reproduce your issue.
3) The Jdk version, such as Oracle JDK1.8.
4) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).

Sincerely
Abel
E-iceblue support team
User avatar

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

Return to Spire.PDF

cron