EnableValidationAppearance and signature.Appearance.Normal.Graphics at the same time?
|
//Creates a digital signature
PdfSignature signature = new PdfSignature(loadedDocument, page, pdfCert, "Signature");
//Sets signature information
signature.Bounds = new RectangleF(0, 100, 200, 100);
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
signature.EnableValidationAppearance = true;
//Create appearance for the digital signature
signature.Appearance.Normal.Graphics.DrawRectangle(PdfBrushes.White, new RectangleF(0, 0, 200, 100));
|
Attachment: Landscape_Test_df99dc13.zip
- Input PDF document.
- Complete code snippet.
Dim doc = New PdfLoadedDocument(input)
store.Open(OpenFlags.ReadOnly)
Dim pageBase As PdfPageBase = doc.Pages(0)
Dim height = pageBase.Size.Height
Dim PdfSignature = New PdfSignature(doc, pageBase, MyCert, "Signature1")
PdfSignature.EnableValidationAppearance = True
PdfSignature.TimeStampServer = New TimeStampServer(New Uri(TimestampServer))
PdfSignature.EnableLtv = EnebleLtv
PdfSignature.DocumentPermissions = PdfCertificationFlags.AllowComments Or PdfCertificationFlags.AllowFormFill Or PdfCertificationFlags.ForbidChanges
PdfSignature.Bounds = GetBounds(pageBase, input)
PdfSignature.ContactInfo = ContactInfo
PdfSignature.LocationInfo = LocationInfo
PdfSignature.Reason = Reason
DrawSignatureInfo(PdfSignature, pageBase.Rotation )
doc.Save(output)
doc.Close(True)
Stavros D.
Attachment: Landscape_Test_unsigned_2f8fb43c.zip
Hi,
It looks like newer version of the library has corrupted the existing feature. I am trying the code suppose to be working but it makes the verification icon behind the Appearance Graphics. Please try following code.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("testpdf.pdf");
PdfCertificate pdfCertificate = new PdfCertificate("testlicense.pfx", "password");
PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], pdfCertificate, "Signature");
signature.Bounds = new RectangleF(0, 100, 200, 100);
signature.ContactInfo = "[email protected]";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
signature.EnableValidationAppearance = true;
signature.Appearance.Normal.Graphics.DrawRectangle(PdfBrushes.White, new RectangleF(0, 0, 200, 100));
loadedDocument.Save();
Process.Start("testpdf.pdf");
Hi Smithangshu,
Thank you for the update!
We suggest that you enable the EnableValidationAppearance feature after you've finished making changes to how your signature looks. We recommended to update your highlighted changes to overcome the issue.
|
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("testpdf.pdf");
PdfCertificate pdfCertificate = new PdfCertificate("testlicence.pfx", "password"); PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], pdfCertificate, "Signature");
signature.Bounds = new RectangleF(0, 100, 200, 100); signature.ContactInfo = "[email protected]"; signature.LocationInfo = "Honolulu, Hawaii"; signature.Reason = "I am author of this document.";
signature.Appearance.Normal.Graphics.DrawRectangle(PdfBrushes.White, new RectangleF(0, 0, 200, 100));
signature.EnableValidationAppearance = true;
loadedDocument.Save("testpdf1.pdf"); Process.Start("testpdf1.pdf"); |
Regards,
Jeyalakshmi T
- 10 Replies
- 5 Participants
-
SD Stavros Dimopoulos
- Dec 15, 2019 06:13 PM UTC
- Jan 8, 2024 02:21 PM UTC