我想在我的文档的最后一页添加页脚。使用我的代码将在我的文档的每个页面上设置页脚。我想过使用OnCloseDocument,但我不确定如何编写它,或者它可能是错的。请帮帮我,谢谢。
Public Class itsEvents
Inherits PdfPageEventHelper
Public Overrides Sub OnStartPage(ByVal writer As iTextSharp.text.pdf.PdfWriter, ByVal document As iTextSharp.text.Document)
'Dim ch As New Chunk("This is my Stack Overflow Header on page " & writer.PageNumber)
'document.Add(ch)
End Sub
Public Overrides Sub OnEndPage(ByVal writer As iTextSharp.text.pdf.PdfWriter, ByVal document As iTextSharp.text.Document)
Dim bf As BaseFont = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED)
Dim cb As PdfContentByte = writer.DirectContent
cb.BeginText()
cb.SetFontAndSize(bf, 12)
cb.SetTextMatrix(50, 75)
cb.ShowText("Marketing")
cb.SetTextMatrix(400, 90)
cb.ShowText("Surabaya,")
cb.SetTextMatrix(400, 75)
cb.ShowText("Penanggungjawab")
cb.EndText()
End Sub
Public Overrides Sub OnCloseDocument(ByVal writer As iTextSharp.text.pdf.PdfWriter, ByVal document As iTextSharp.text.Document)
End Sub
End Class