以下のコードを使用して生成している PDF のヘッダーとして使用したい画像があります。これを行うことは可能ですか?ありがとう!
Dim Doc1 As New Document
Dim path As String = "" + Session("Username") + "\"
If (Not System.IO.Directory.Exists(path)) Then
System.IO.Directory.CreateDirectory(path)
End If
Dim myUniqueFileName = String.Format("{0}.pdf", random)
Dim pdfWrite As PdfWriter = PdfWriter.GetInstance(Doc1, New FileStream(path & myUniqueFileName, FileMode.Create))
Dim ev As New itsEvents
pdfWrite.PageEvent = ev
Doc1.Open()
Dim test As String
test = Session("PDF")
Doc1.Add(New Paragraph(test))
Doc1.Close()
End Sub
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 header " & writer.PageNumber)
document.Add(ch)
End Sub
End Class