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.

Thu Jul 11, 2019 10:11 am

Hi everyone,

May I know, how can I address the below business need using Spire.PDF
- While digitally signing PDFs, the signatures need to be extracted from the digital signature dongle connected to the local computer (not using the PFX files)

Thanks in advance
Subeesh

subeeshnarayanan
 
Posts: 1
Joined: Thu Jul 11, 2019 6:36 am

Thu Jul 11, 2019 11:20 am

Hello,

Thanks for your post.
Our Spire.PDF supports getting the certificate which is set as exported from the certificate store on the computer and then to sign PDF. You can refer to the following code to test your case. If there is any question, just feel free to write back.
Code: Select all
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"sample.pdf");
PdfPageBase page = doc.Pages[0];
X509Store store = new X509Store("My");
store.Open(OpenFlags.ReadOnly);
//get the certificate, might you need to change this condition accroding to your case.
PdfCertificate cert = new PdfCertificate(store.Certificates[0].GetRawCertData());
PdfSignature sig = new PdfSignature(doc, page, cert, "demo");
sig.Bounds = new RectangleF(new PointF(280, 600), new SizeF(260, 90));
sig.DocumentPermissions = PdfCertificationFlags.ForbidChanges;
sig.Date = DateTime.Now;
sig.GraphicsMode = GraphicMode.SignNameAndSignDetail;
//save file
doc.SaveToFile(@"Signature.pdf");


Sincerely,
Lisa
E-iceblue support team
User avatar

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

Return to Spire.PDF

cron