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

Know how many signatures PDF has

Thread ID:





147103 Sep 1,2019 10:32 PM UTC Jun 12,2020 01:04 PM UTC WinForms 13
Tags: PDF
Asked On September 1, 2019 10:32 PM UTC


I saw in recent documentation that we need to set "SignatureField(0)" with a signature and, if we're trying to resign a document, we need to work on "SignatureField(1)" - which makes sense to me.

But if we think about a document with many signatures (one author and several reviewers/approvals), how can we deal with them?
How do we resign a document with many signatures there?

I appreciate any help on this.

Surya Kumar [Syncfusion]
Replied On September 2, 2019 11:24 AM UTC

Hi David, 

Greetings from Syncfusion. 

You can refer the below mentioned KB to add multiple signature to the PDF document. 

Surya Kumar 

Replied On September 2, 2019 03:54 PM UTC

Hi Surya, thanks for your tip.

I had seen this code before and I guess it's not related to my problem because:

- It gets a signed document without any logo attached to the existing signature. In my case, the read document may (or may not) contain an image.

- My code is getting all signatures and resigning the document normally - the problem may be related to the lack of all pre-existing signatures' images, but not the last one (which I perform by myself).

- The sample code consider that all certificates (and their passwords) are available in disk. This is not my scenario. I receive a previous signed document (from any one of any city/country) and I need to certify that the document was read and reviewed.

So, I don't know neither how many signatures the PDF has, nor if some of them has a logo attached; which is TRUE in some cases before I did it by myself in some stages of the document review - but it is FALSE in other signatures performed by others in some other moment.

Am I clear enough?  If not, please feel free to contact me and I'll try to explain deeper.

Kindest regards,

Sowmiya Loganathan [Syncfusion]
Replied On September 3, 2019 02:06 PM UTC

Hi David, 

As we said earlier when modifying the existing PDF with signature will invalidate the previously set signature in the original document. However we have tried the sample to resign the PDF document to reproduce the mentioned issue and the image is preserved in the resultant PDF. Please refer the below sample for more details, 

Please try the above sample in your end and let us know the result. Could you please share us the input/output PDF documents and code snippet which you have used in your end. It will helpful for us to provide the precise solution on this. 

Sowmiya L 

Replied On September 3, 2019 08:02 PM UTC

Dear Sowmiya,

Thank you in advance for your help, time and efforts to help me.

I couldn't compile de source since even using the latest libraries (17.2460.0.46) the source points to:
warning MSB3277: Found conflicts between different versions of "Syncfusion.Compression.Base" that could not be resolved

Interesting notice that I removed all of your Syncfusion references and set again all of them mine. Anyway, I'll try to convert your code into my application and see if I get the same results.

BUT ...

I'm curious about why a pre-existent signature is invalidated in a PDF even if we set both siganures (older and newer) to "AllowFormFills" - or in other words, we do not forbid the document to be modified.

Again, thank you for your help and time.

Replied On September 4, 2019 10:52 AM UTC

Dear Sowmyia,

I was researching a little in Internet and something occurred to me:

- The signatures in PDF can be invalidated IF we add any other signature AFTER a "certified" one.
- In some interactions I made before, I notice that, if we set "CERTIFIED= FALSE" the PDF control raises an error.

So, I was thinking if the problem with "no certified signatures" are related to signatures are being set as "certified", even we do not setting this.

Another thing I saw in my tests were the fact of, event changing the PDFFieldName to an increasing name (Sig_0, Sig_1, and so forth), if we add the next signature in a first run (not in sequence as shown in your sample), the field name is always the same of the previous one.

Let me show you:

Dim SignedFile As String = ThisFileLocation.Replace(".pdf", ".signed.pdf")

Dim loadedDocument As New PdfLoadedDocument(ThisFileLocation, True)
Dim page As PdfLoadedPage = TryCast(loadedDocument.Pages(0), PdfLoadedPage)
Dim signature As PdfSignature = Nothing

Dim ExistingFields As Integer = 0
Dim String_Signature As String = "Signature_" & ExistingFields.ToString


     ' here the program raises an error if the doc does not contain any signature

     ExistingFields = loadedDocument.Form.Fields.Count

     Dim SigField As PdfLoadedSignatureField = TryCast(loadedDocument.Form.Fields(0), PdfLoadedSignatureField)

     'here I don't update the String_Signature field name, so, it us "Signature_0"

     signature = New PdfSignature(loadedDocument, page, pdfCert, String_Signature, SigField)

     Dim TempStream As MemoryStream = New MemoryStream loadedDocument.Save(TempStream)

     loadedDocument = New PdfLoadedDocument(TempStream)

     'here I do update the String_Signature field name, so, it is "Signature_1"

     String_Signature = "Signature_" & ExistingFields.ToString

     signature = New PdfSignature(loadedDocument, page, pdfCert, String_Signature)

Catch ex As Exception

     'here I don't update the String_Signature field name, so, it us "Signature_0"

     signature = New PdfSignature(loadedDocument, page, pdfCert, String_Signature)

End Try

'Other settings like displacement of visible field"

Dim x As Single = CSng(X_coord.Text)

Dim y As Single = CSng(Y_Coord.Text)

Signature.Bounds = New RectangleF(New PointF(x, y), ImageSize)

signature.TimeStampServer =New TimeStampServer(New Uri("<time stamp server>"))

signature.EnableValidationAppearance = False

signature.EnableLtv = True

'So, I draw the logo and write some graphic texts - this is only a sample to see what I'm doing..."

loadedDocument.Pages(0).Graphics.DrawImage(bmp, New PointF(x, y), New SizeF(w,h))

loadedDocument.Pages(0).Graphics.DrawString("Serial: xxxxxxxxxxxxxx")

loadedDocument.Pages(0).Graphics.DrawString("TimeStamp: YES")

Well, after doing this, if I

- sign a virgin document (without any signature), NOT certifying the sign;

- save the document;

- load the saved one (signed);

- make another signature using another certificate.

... the seconds one is INVALID and I see BOTH fields with the same name "Signature_0".

So, I believe we have problems with this control!

Notice that in your sample you're signing twice the same document and using available PFX's - which in practice is not applicable. I'm talking about to receive a signed doc from anyone which I don't have PFX file (the AUTHOR but with a no certified signature) and re-sign it like a REVIEW.

Can you help on this situation?

Kindest regards,


Sowmiya Loganathan [Syncfusion]
Replied On September 4, 2019 12:12 PM UTC

Hi David, 

I couldn't compile de source since even using the latest libraries (17.2460.0.46) the source points to: 
warning MSB3277: Found conflicts between different versions of "Syncfusion.Compression.Base" that could not be resolved 
We suspect that this issue may occurs due to conflicts in App.config file. So please remove the “Syncfusion.Compression.Base” dependency assembly reference other than v17.2.0.46 in App.config file of provided sample. However we have created the sample for the same with the product version  

I'm curious about why a pre-existent signature is invalidated in a PDF even if we set both siganures (older and newer) to "AllowFormFills" - or in other words, we do not forbid the document to be modified. 
  • When modifying an existing PDF signature like changing the appearance, etc., it will invalidate the previous signature in the original PDF, so this could be the behavior.   
  • AllowFormFills” signature permission is used to sign the PDF document using empty signature field (signature field does not contain signature before).
  • Pre-existing signature will fail if you sign PDF document using already signed signature field even if setting of “AllowFormFills” permission. Due to this only we have apply multiple signature one by one. Please refer the below KB link for you reference,


Sowmiya L 

Replied On September 4, 2019 01:24 PM UTC

Dear Sowmyia,

I guess I'm no being clear enough - my fault.

The samples you gave me are NOT my intention, since in both signatures I have the correspondent PFX file.

My problem is focused into a document that can be sent and received for people in differents places!
I can be capable to receive an already signed PDF and put my own sign too.

According to Adobe, if no one signature is "certified", it is possible without any error.

And this is the main problem!  PDF control allow us to sign ONCE - or, in a given example, sign twice since I have both PFX files, which is not the case I mention above.
I have FOXIT software here and there I can perform my own signature in documents I receive already signed by others.

I appreciate you time and efforts to help me but I don't understand why is so difficult to understand this usual behaviour in a PDF doc:  I sign a doc by my own and send it to a third-party to be reviewed and signed too, using his own certificate.

Kindest regards,

PS: Ops! I forgot! Since the PDF control raises an error when I set manually "CERTIFIED = FALSE", I guess the problem may me related to this!  If ALL signatures are being performed like "Certified", I would have this behaviour.  Please, check it.

Replied On September 4, 2019 04:23 PM UTC

Dear Sowmyia,

The sample you gave me points an error when I execute him, as I describe below:

1- I have a PDF already signed.

2- When I execute your code using all correct parameters (file, certificate, etc) it breaks at line 49 due to System.IndexOutOfRange - the code cannot locate Fields[1] but only Fields[0].  

//Gets the seocnd signature field of the PDF document
PdfLoadedSignatureField signatureField2 = signedDocument.Form.Fields[1] as PdfLoadedSignatureField;

Why the fields collection was not increased once we add a new sign on the previous line?
I see your code is semanticaly right, but the collection shows only ONE field.

Sowmiya Loganathan [Syncfusion]
Replied On September 5, 2019 01:10 PM UTC

Hi Sheryl, 

If you want to print the data in PDF as like in the ListView, you can create the PdfGrid by manually adding values from Post mysql data. Please refer the below code snippet for more details,  

//Get values from SQL  
SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation); 
var posts = conn.Table<Post>().ToList(); 
//Create a new PDF document 
PdfDocument document = new PdfDocument(); 
//Add a page 
PdfPage page = document.Pages.Add(); 
//Create the parent grid 
PdfGrid parentPdfGrid = new PdfGrid(); 
//Add the columns to parent grid  
for (int i = 0; i < posts.Count; i++) 
    //Add the rows to parent grid based on the post count  
    PdfGridRow parentRow = parentPdfGrid.Rows.Add(); 
    //Create the child table 
    PdfGrid childPdfGrid = new PdfGrid(); 
    //Set the column and rows for child grid 
    for (int j = 0; j < 3; j++) 
    //create and customize the string formats 
    PdfStringFormat format = new PdfStringFormat(); 
    format.Alignment = PdfTextAlignment.Center; 
    //Add values to cell respective to post values for row1 
    PdfGridRow childRow1 = childPdfGrid.Rows[0]; 
    childRow1.Cells[0].Value = posts[i].CDateTime; 
    childRow1.Cells[0].ColumnSpan = 2; 
    childRow1.Cells[0].StringFormat = format; 
    PdfGridRow childRow2 = childPdfGrid.Rows[1]; 
    childRow2.Cells[0].Value = posts[i].rain1Lbl; 
    childRow2.Cells[1].Value = posts[i].rain1vol; 
    PdfGridRow childRow3 = childPdfGrid.Rows[2]; 
    childRow3.Cells[0].Value = posts[i].rain2Lbl; 
    childRow3.Cells[1].Value = posts[i].rain2vol; 
    //Assign child grid to parent grid cell 
    parentRow.Cells[0].Value = childPdfGrid; 
//Draw parent grid 
parentPdfGrid.Draw(page, PointF.Empty); 
//Save the document to the stream 
MemoryStream stream = new MemoryStream(); 
//Close the document 

Please try the above solution in your end and let us know if it satisfies your requirement.  

Sowmiya L 

Replied On September 5, 2019 02:02 PM UTC

Wrong interaction Sowmiya!

Surya Kumar [Syncfusion]
Replied On September 10, 2019 02:14 PM UTC

Hi David, 
We have created sample to add signature to existing signed PDF document by creating a new field and also by signing in the existing field. Please try the same and let us know if it meets your requirement.  
If not kindly modify the sample given to reproduce the issue which you have mentioned.  

Let us know if you need any further information. 

Surya Kumar 

Replied On June 11, 2020 04:56 PM UTC

Hi Team,

I have a similar issues. Its says signature invalid after adding a new signature to an already existing document with digital signature pdf .Could any one have some insight on this.

Thanks in advance. 


Sowmiya Loganathan [Syncfusion]
Replied On June 12, 2020 01:04 PM UTC

Hi Thamem,    
Thank you for contacting Syncfusion support.    
We have analyzed the reported issue “Signature invalid when signing an existing PDF document with digital signature” and this occurs due to adding of trial version watermark in the resultant PDF document. However, this issue can be overcome by using licensed assemblies. Please refer the below output document for more details,    
Code snippet:    
//Load PDF document    
PdfLoadedDocument loadedDocument = newPdfLoadedDocument("SignatureDocument.pdf");   
//Load PDF page    
PdfPageBase page = loadedDocument.Pages[0];   
PdfCertificate pdfCert = new PdfCertificate(DataPathBase+@"PDF.pfx""syncfusion");   
//Creates a digital signature   
PdfSignature signature = new PdfSignature(loadedDocument, page, pdfCert, signatureName);   
//Sets signature information   
signature.Bounds = new RectangleF(300,300,150,50);   
signature.ContactInfo = "johndoe@owned.us";   
signature.LocationInfo = "Honolulu, Hawaii";   
signature.Reason = "I am author of this document.";   
signature.EnableValidationAppearance = true;   
//Sets an image for the signature field   
PdfBitmap signatureImage = new PdfBitmap(DataPathBase + @"signature.png");   
signature.Appearance.Normal.Graphics.DrawImage(signatureImage, new RectangleF(0,0, 150,50));   
Note: While using a trial product version to add multiple signatures in PDF document, this will invalidate the existing signature.    
So please use the licensed assemblies to add multiple signatures in PDF document and let us know the result.    
Sowmiya Loganathan 


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