Dear Team,
There is a requirement in our company for Digitally Signing a PDF Document and displaying the Signature in all pages of the Signed PDF Document.
Using current methods, we can display the signature in all the pages.
However only the digital signature in the last page is shown as VALID while all the signatures before that is shown as INVALID (Document altered).
Can we overcome this obstacle using ASPOSE PDF API?
Hi Balakrishna,
Hi,
Please find the code below
------------------------------------------------
Sub Main()
Dim dataDir As String = “D:”
'Import PDF Document
Dim pdfdoc As New Document(dataDir & “input.pdf”)
'create PdfFileSignature object and choose input document
Dim pdfSign As New PdfFileSignature(pdfdoc)
'create a rectangle for signature location
Dim rect As New System.Drawing.Rectangle(100, 100, 200, 100)
'create signature
Dim signature As New PKCS1(“pfxfilename.pfx”, “passwd”)
'Sign
For i As Integer = 1 To pdfdoc.Pages.Count
If i > 4 Then
Exit Sub
End If
pdfSign.Sign(i, “Signature Reason”, “Contact”, “Location”, True, rect, signature)
pdfSign.Save(dataDir & “output.pdf”)
pdfSign.Close()
pdfSign = New PdfFileSignature(dataDir & “output.pdf”)
Next
End Sub
------------------------------------------------------
Hi Balakrishna,
Dim dataDir As String = "c:\pdftest"<o:p></o:p>
'Import PDF Document
Dim pdfdoc As New Document(dataDir & "Concatenated_output.pdf")
'create PdfFileSignature object and choose input document
Dim pdfSign As Aspose.Pdf.Facades.PdfFileSignature = New Aspose.Pdf.Facades.PdfFileSignature(pdfdoc)
'create a rectangle for signature location
Dim rect As New System.Drawing.Rectangle(100, 100, 200, 100)
'create signature
Dim signature As New Aspose.Pdf.InteractiveFeatures.Forms.PKCS1("c:/pdftest/MySPC.pfx", "test")
'Sign
For i As Integer = 1 To pdfdoc.Pages.Count
If i > 4 Then
Exit Sub
End If
pdfSign.Sign(i, "Signature Reason", "Contact", "Location", True, rect, signature)
pdfSign.Save(dataDir & "Signed_output.pdf")
pdfSign.Close()
pdfSign = New Aspose.Pdf.Facades.PdfFileSignature()
pdfSign.BindPdf(dataDir & "Signed_output.pdf")
Next