When I use Spire.PDF trial version, I have two issues, the first digital signature will be invalid when I add a second one and they aren't visible on PDF. I consider the license version can fix those issues, right?
This is my codes:
- Code: Select all
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"../../DOTForm.pdf");
PdfPageBase page = doc.Pages[0];
String pfxPath = @"../../HungBui.pfx";
PdfCertificate cert = new PdfCertificate(pfxPath, "abcxyz");
var form = (PdfFormWidget)doc.Form;
if (form.FieldsWidget.Count > 0)
{
var field = form.FieldsWidget["Signature"] as PdfSignatureFieldWidget;
PdfSignature signature = new PdfSignature(doc, page, cert, "demo", field);
signature.DocumentPermissions = PdfCertificationFlags.ForbidChanges;
signature.IsTag = true;
signature.DigitalSignerLable = "Digitally signed by";
signature.DigitalSigner = "Hung Bui";
signature.DistinguishedName = "DN:";
signature.LocationInfoLabel = "Location:";
signature.LocationInfo = "London";
signature.ReasonLabel = "Reason: ";
signature.Reason = "Le document est certifie";
signature.DateLabel = "Date: ";
signature.Date = DateTime.Now;
signature.ContactInfoLabel = "Contact: ";
signature.ContactInfo = "123456789";
signature.Certificated = true;
}
//Save pdf file.
doc.CompressionLevel = PdfCompressionLevel.Best;
doc.SaveToFile(@"../../DigitalSignature.pdf");
doc.Close();