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.

Sat Feb 22, 2020 1:08 pm

I am trying to apply digital signature to existing PDF document using spire pdf and send the mail to the user but in the received pdf over the mail I am getting error as the certification is invalid. That means signature becoming invalid.
Can you please help with the issue.
Note: the code is working perfectly on locally but when I am deploying the application on azure server I am getting this issue.

My Code:
PdfDocument doc = new PdfDocument("Test.pdf");
PdfPageBase page = doc.Pages[0];

PdfCertificate cert = new PdfCertificate("demo.pfx", "XXXX");

PdfSignature signature = new PdfSignature(doc, page, cert, "demo");

signature.ContactInfo = "Harry";
signature.Certificated = true;

signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill;

var mem = new MemoryStream();
doc.SaveToStream(mem, Spire.Pdf.FileFormat.PDF);
mem.Position = 0;
doc.Close();




using (MailMessage email = new MailMessage())
{

MailAddress fromAddress = new MailAddress("XXXXX", "XXXX");
email.To.Add("XXXXX");

System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType(System.Net.Mime.MediaTypeNames.Application.Pdf);
System.Net.Mail.Attachment attach = new System.Net.Mail.Attachment(mem, ct);
attach.ContentDisposition.FileName = "myFile.pdf";

email.From = fromAddress;
email.Attachments.Add(attach);
using (SmtpClient smtpClient = new SmtpClient())
{
smtpClient.Host = "XXXXX";
smtpClient.EnableSsl = true;
smtpClient.Port = XXXX;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials = new System.Net.NetworkCredential("XXXX", "XXXX");
smtpClient.Timeout = 6000000;
smtpClient.Send(email);
}

swapnilborpe
 
Posts: 3
Joined: Sat Feb 22, 2020 12:53 pm

Mon Feb 24, 2020 3:15 am

Hello,

Sorry for the late reply as weekend.
I have reproduced your issue and logged it in our bug tracking system with the ticket SPIREPDF-3067. If there is any update, we will let you know.
Apologize for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Feb 26, 2020 9:05 am

Hi

just wondering if there's any update on this issue.

Many thanks in advance,
Swapnil Borpe


rachel.lei wrote:Hello,

Sorry for the late reply as weekend.
I have reproduced your issue and logged it in our bug tracking system with the ticket SPIREPDF-3067. If there is any update, we will let you know.
Apologize for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team

swapnilborpe
 
Posts: 3
Joined: Sat Feb 22, 2020 12:53 pm

Wed Feb 26, 2020 10:06 am

Hello,

Thanks for your following up.
Sorry to tell that there is no significant progress on your issue at present. Our Dev time is still fixing it, please spare us more time.
Anyway, we will let you know once there is any update.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Sun May 31, 2020 8:02 am

rachel.lei wrote:Hello,

Thanks for your following up.
Sorry to tell that there is no significant progress on your issue at present. Our Dev time is still fixing it, please spare us more time.
Anyway, we will let you know once there is any update.

Sincerely,
Rachel
E-iceblue support team


Hi,

Any updates on this issue. We are facing this issue since long time.
Please help.

Thanks and Regards
Swapnil Borpe

swapnilborpe
 
Posts: 3
Joined: Sat Feb 22, 2020 12:53 pm

Mon Jun 01, 2020 9:09 am

Hello,

Thanks for your following up.
Sorry to tell you that our Dev team is still fixing this issue due to its complexity. I have urged them and given your issue the highest priority. We will notify you as soon as it is fixed.
Apologize for the delay and inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Jun 05, 2020 2:27 am

Hello,

Thanks for your patient waiting.
After the further investigation by our Dev team, we found that to allow applications on Azure Websites to load certificates from PFX, you need to set the App Setting WEBSITE_LOAD_USER_PROFILE to 1, as shown below. Please verify it on your side and then tell us the result. Looking forward to your further feedback.

Azure_Application_Setting.png

Article for your kind reference: https://azure.microsoft.com/zh-tw/blog/ ... -websites/

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Tue Jun 09, 2020 10:04 am

Hello,

Greetings from E-iceblue!
Have you verified it on your side? What's your test result?
Any feedback would be greatly appreciated!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.PDF