I'm evaluating Spire.PDF, all is working fine, except the timestamp the signed document.
I copied exact the sample code, only change my certifcate and local paths.
When I run without timestamp it works, but if I run with timestamp, it show many errors on console like the image attached.
Code:
- Code: Select all
//create a PdfDocument object and load a PDF file
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("med.pdf");
//load the certificate .pfx file
PdfCertificate cert = new PdfCertificate(@"ECPF 2019 1000521089.pfx", "PWD");
//add a signature to the specified position
PdfSignature signature = new PdfSignature(doc, doc.Pages[0], cert, "signature");
signature.Bounds = new RectangleF(new PointF(350, 700), new SizeF(180, 90));
//set the signature content
signature.NameLabel = "Digitally signed by:Gary";
signature.LocationInfoLabel = "Location:";
signature.LocationInfo = "CN";
signature.ReasonLabel = "Reason: ";
signature.Reason = "Ensure authenticity";
signature.ContactInfoLabel = "Contact Number: ";
signature.ContactInfo = "028-81705109";
signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill | PdfCertificationFlags.ForbidChanges;
signature.GraphicsMode = GraphicMode.SignImageAndSignDetail;
signature.SignImageSource = PdfImage.FromFile(@"logo_bol.png");
//configure a timestamp server
string url = "https://freetsa.org/tsr";
signature.ConfigureTimestamp(url);
//save to file
doc.SaveToFile("output.pdf");