but this can sign only pdf sontaining one page ,how can make it to sign all
pages...
Public Sub Sign(ByVal SigReason As String, ByVal SigContact As String, ByVal
SigLocation As String, ByVal visible As Boolean, ByVal x As Single, ByVal y
As Single, _
ByVal x1 As Single, ByVal y1 As Single, ByVal val1 As Boolean, ByVal val2 As
Boolean, ByVal val3 As Boolean, ByVal def As Boolean)
Dim reader As New PdfReader(Me.inputPDF)
'Activate MultiSignatures
Dim st As PdfStamper = PdfStamper.CreateSignature(reader, New
FileStream(Me.outputPDF, FileMode.Create, FileAccess.Write),
ControlChars.NullChar, Nothing, True)
'To disable Multi signatures uncomment this line : every new
signature will invalidate older ones !
'PdfStamper st = PdfStamper.CreateSignature(reader, new
FileStream(this.outputPDF, FileMode.Create, FileAccess.Write), '\0');
st.MoreInfo = Me.metadata.getMetaData()
st.XmpMetadata = Me.metadata.getStreamedMetaData()
Dim sap As PdfSignatureAppearance = st.SignatureAppearance
sap.Acro6Layers = True
sap.SetCrypto(Me.myCert.Akp, Me.myCert.Chain, Nothing,
PdfSignatureAppearance.WINCER_SIGNED)
If def = False Then
If val1 = False Then
sap.Reason = SigReason
End If
If val2 = False Then
sap.Contact = SigContact
End If
If val3 = False Then
sap.Location = SigLocation
End If
End If
If visible Then
sap.SetVisibleSignature(New iTextSharp.text.Rectangle(x, y, x1,
y1), 1, Nothing)
If def = True Then
Dim fontSig As Font =
FontFactory.GetFont(FontFactory.HELVETICA, CSng(7), Font.NORMAL)
sap.Layer2Font = fontSig
'sap.Render =
PdfSignatureAppearance.SignatureRender.Description;
Dim signerName As String =
PdfPKCS7.GetSubjectFields(Me.myCert.Chain(0)).GetField("CN")
Dim template As PdfTemplate =
st.SignatureAppearance.GetLayer(2)
template.MoveTo(0, 200)
template.LineTo(500, 0)
template.Stroke()
template.BeginText()
Dim bf1 As BaseFont =
BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252,
BaseFont.NOT_EMBEDDED)
template.SetFontAndSize(bf1, 10)
template.SetTextMatrix(1, 1)
template.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "" &
signerName & "", 0, 40, 0)
Dim bf As BaseFont = BaseFont.CreateFont(BaseFont.HELVETICA,
BaseFont.CP1252, BaseFont.NOT_EMBEDDED)
template.SetFontAndSize(bf, 7)
template.SetTextMatrix(1, 1)
template.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "" &
System.DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss zzz") & "", 50, 30, 0)
template.SetFontAndSize(bf, 7)
template.SetTextMatrix(1, 1)
template.ShowTextAligned(PdfContentByte.ALIGN_LEFT,
"Signer:", 0, 25, 0)
template.SetFontAndSize(bf, 7)
template.SetTextMatrix(1, 1)
template.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "" &
"CN=" & PdfPKCS7.GetSubjectFields(myCert.Chain(0)).GetField("CN") & "", 10,
17, 0)
template.SetFontAndSize(bf, 7)
template.SetTextMatrix(1, 1)
template.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "" &
"C=" & PdfPKCS7.GetSubjectFields(myCert.Chain(0)).GetField("C") & "", 10,
10, 0)
template.EndText()
End If
End If
st.Close()
End Sub
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Multiple-pdf-sign-in-all-pages-with-itext-tp2163303p3562425.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php