我试图将html面板转换为pdf面板包含面板和图像表 问题是当我按下按钮消息显示堆栈空
Protected Sub ShowPDF_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf")
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim sw As New StringWriter()
Dim hw As New HtmlTextWriter(sw)
Me.Page.RenderControl(hw)
Dim sr As New StringReader(textConvert(sw.ToString()))
Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 100.0F, 0.0F)
Dim htmlparser As New HTMLWorker(pdfDoc)
PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
pdfDoc.Open()
htmlparser.Parse(sr)
pdfDoc.Close()
Response.Charset = Encoding.UTF8.ToString()
Response.Write(pdfDoc)
Response.[End]()
Catch ex As Exception
MsgBox(ex.Message))
End Try
End Sub