我正在使用下面的代码生成 PDF 并将其保存到某个位置。是否可以将其作为附有生成的 PDF 的电子邮件发送出去?我假设电子邮件编码需要在 HTML 中完成?因为它将在网络服务器上。这可能吗?
Dim Doc1 As New Document
Dim path As String = "\\Server\Folder" + 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")
Dim imagepath As String = Server.MapPath(".") & "/images/Header.png"
Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(imagepath)
image.ScalePercent(70.0F)
' image.SetAbsolutePosition(36.0F, 36.0F)
Doc1.Add(image)
Doc1.Add(New Paragraph(test))
Doc1.Close()