SmartCard signature on PDF in Web Application

Hi,
We need to sign pdf document with smart card on web application. with windows authentication.
we add your code

But the code does not recognize client smart card.
do you know how we can get client smart card in server?

@ido.roman.ness

Could you please share the modified code snippet that you prepared to add client smart card? We will test the scenario in our environment and address it accordingly.

using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(msToPrint))
{
try
{
SignatureField field1 = new SignatureField(doc.Pages[doc.Pages.Count - 1], new Rectangle(400, 400, 10, 10));
FormEditor formEditor = new FormEditor();
// Open Document
formEditor.BindPdf(msToPrint);
// Add field
X509Store store = new X509Store(“MY”, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection collection = store.Certificates;
X509Certificate2Collection fcollection = collection.Find(X509FindType.FindByTimeValid, DateTime.Now, false);
X509Certificate2Collection scollection = X509Certificate2UI.SelectFromCollection(fcollection, “Test Certificate Select”, “Select a certificate from the following list to get information on that certificate”, X509SelectionFlag.SingleSelection);
Aspose.Pdf.Forms.ExternalSignature externalSignature = new Aspose.Pdf.Forms.ExternalSignature(scollection[0]) { ContactInfo = scollection[0].FriendlyName };
field1.PartialName = “sig1”;
doc.Form.Add(field1, 1);
field1.Sign(externalSignature);
doc.Save(msToPrint, SaveFormat.Pdf);
}
catch(Exception e)
{
throw e;
}

image.png (107.3 KB)

@ido.roman.ness

We tested the same code snippet in our environment using Aspose.PDF for .NET 21.3 and did not notice any issue. The output generated by the code is also attached for your kind reference. Would you kindly make sure that the Certificate is properly installed in the system where you are running the code snippet. Please try to share a sample console or web application for our reference which is able to reproduce the error. We will again test the scenario in our environment and address it accordingly.

signed.pdf (41.3 KB)