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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

149939 Dec 15,2019 06:13 PM UTC Mar 9,2020 10:36 AM UTC WinForms 8
loading
Tags: PDF
Stavros Dimopoulos
Asked On December 15, 2019 06:13 PM UTC

Hi!

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)?

Sowmiya Loganathan [Syncfusion]
Replied On December 16, 2019 10:34 AM UTC

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. 
 
Regards, 
Sowmiya Loganathan 


Stavros Dimopoulos
Replied On December 19, 2019 12:54 AM UTC

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!

Sowmiya Loganathan [Syncfusion]
Replied On December 19, 2019 08:40 AM UTC

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


Stavros Dimopoulos
Replied On February 29, 2020 09:23 PM UTC

It works, the background image is displayed correctly.

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

Stavros Dimopoulos
Replied On March 5, 2020 05:52 PM UTC

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

Prakash Viswanathan [Syncfusion]
Replied On March 6, 2020 12:28 PM UTC

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.

Regards, 
Prakash V 


Stavros Dimopoulos
Replied On March 6, 2020 06:29 PM UTC

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)
        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

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

        doc.Save(output)
        doc.Close(True)

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!
Regards,
Stavros D.

Attachment: Landscape_Test_unsigned_2f8fb43c.zip

Prakash Viswanathan [Syncfusion]
Replied On March 9, 2020 10:36 AM UTC

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.    
 
Regards, 
Prakash V 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon