We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

EnableValidationAppearance and signature.Appearance.Normal.Graphics at the same time?


On a PDF file, Is it possible to draw a custom signature using "signature.Appearance.Normal.Graphics" and then enable the "EnableValidationAppearance" so that the PDF viewer will automatically draw the validation mark over the signature?

I tried to do it but when "EnableValidationAppearance" is enabled the signature graphics is not displayed.
Is it possible that the validation background is white (not transparent)?

8 Replies

SL Sowmiya Loganathan Syncfusion Team December 16, 2019 05:34 AM

Hi Stavros,  
Thank you for contacting Syncfusion support.  
We can achieve your requirement by enable the “EnableValidationAppearance” and then draw the custom signature appearance in PDF document. Please refer the below code snippet for more details, 
//Creates a digital signature 
PdfSignature signature = new PdfSignature(loadedDocument, page, pdfCert, "Signature"); 
//Sets signature information 
signature.Bounds = new RectangleF(0, 100, 200, 100); 
signature.ContactInfo = "johndoe@owned.us"; 
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)); 
Please try the above solution in your end and let us know whether your requirement is achieved or not. If not kindly share us the further details about your requirement, it will helpful us to provide the precise solution on this. 
Sowmiya Loganathan 

SD Stavros Dimopoulos December 18, 2019 07:54 PM

Thanks for the solution!

At the moment I have to solve another problem. The latest Windows Update has compatibility problems with ClickOnce applications so I have to make the app working again before testing the solution.

Thank you!

SL Sowmiya Loganathan Syncfusion Team December 19, 2019 03:40 AM

Hi Stavros,  
Thanks for the update. We will wait to hear from you.  
Sowmiya Loganathan 

SD Stavros Dimopoulos February 29, 2020 04:23 PM

It works, the background image is displayed correctly.

I still have issues when the page is rotated but I will figure it out.

SD Stavros Dimopoulos March 5, 2020 12:52 PM

I just noticed that the orientation of the signature Graphics object is different if I disable the EnableValidationAppearance option.

The issue occurs only in landscape pages (rotation = 90°).

I signed both pdf attachments with the same code. The only difference is that I commended out the EnableValidationAppearance option in the second file. If you move your cursor over the digital signature, it is obvious that the bounds of the digital signature are correct, however the text is drawn with the wrong orientation.

Another minor problem I noticed is that the validation mark is drawn over the text and the text under it is almost unreadable. It would be very useful if the validation text is positioned on top of the signature and the validation mark is positioned in a layer under the custom text layer, like this:

Attachment: Landscape_Test_df99dc13.zip

PV Prakash Viswanathan Syncfusion Team March 6, 2020 07:28 AM

Hi Stavros,   
Thank you for your update.    
We have checked the reported issue and we suspect that the issue may occur with a particular PDF document. So, kindly provide below details to reproduce the reported issues in our end. So that it will be more helpful for us to reproduce and analyze further about this issue.    
  1. Input PDF document.
  2. Complete code snippet.

Prakash V 

SD Stavros Dimopoulos March 6, 2020 01:29 PM

I attached the input PDF document. It is created using a IntelliCAD based software, using print-> "Adobe pdf". The orientation was set to Landscape.
If you comment out the line "PdfSignature.EnableValidationAppearance = True", you will see that the content of the signature is rotated.

The source code is:
        Dim store As New X509Store(StoreName.My, StoreLocation.CurrentUser)
        Dim doc = New PdfLoadedDocument(input)
        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

        DrawSignatureImage(PdfSignature, pageBase.Rotation)
        DrawSignatureInfo(PdfSignature, pageBase.Rotation )


I also noticed that even with EnableValidationAppearance = True, the signature validation mark is displayed different in portrait and in landscape mode.

Document page in portrait (RotationAngle0):

Document page in landscape mode (RotationAngle90):

The above bugs are not very important and at the moment I can continue my project with the existing functionality. I just want to report bugs so you can make your product even better!
Stavros D.

Attachment: Landscape_Test_unsigned_2f8fb43c.zip

PV Prakash Viswanathan Syncfusion Team March 9, 2020 05:36 AM

Hi Stavros,   
Thank you for sharing the details.    
We have checked the reported issue, when we enable the EnableValidationAppearance, we will not create any appearance for the signature. The PDF viewers/readers will create appearance based on this value. The adobe reader renders the appearance, based on the page. So, the reported issue does not occur with our library.    
Please let us know if you need any other assistance with this.    
Prakash V 

Live Chat Icon For mobile
Up arrow icon