I got a task from my employer to test Spire.PDF before buying license.
The main point is PDF signing with smart card sertificate.
I am using this code (sertificate replaced into Demo):
- Code: Select all
static void SignTest(string SourceFile, string DestFile)
{
Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument(SourceFile);
PdfCertificate cert = new PdfCertificate("Demo.pfx", "e-iceblue");
var signature = new Spire.Pdf.Security.PdfSignature(doc, doc.Pages[0], cert, "demo");
signature.Bounds = new RectangleF(new PointF(280, 600), new SizeF(260, 90));
signature.NameLabel = "ąčęėįšųūž my signature";
signature.DateLabel = "Date: ";
signature.Date = DateTime.Now;
signature.DocumentPermissions = PdfCertificationFlags.ForbidChanges;
doc.SaveToFile(DestFile);
}
got two problems to solve:
1. when signing timestamped PDF, timestamp got broken. How to append my signature, without document changes and breaking of timestamp? (picture1 added)
2. when using special language letters (all listed in signature.NameLabel property), got text like in picture2.
Could You please help me with these problems?