我无法将包含Gridview和图像的面板导出为PDF。有什么建议吗?
这是我导出Gridview的代码,它成功完成了。但是我需要将Gridview和我的图像导出到Gridview上方,两者都包含在面板中。
Using sw As New StringWriter()
Using hw As New HtmlTextWriter(sw)
'To Export all pages
GridView1.AllowPaging = False
Me.LoadDataGrid()
GridView1.RenderControl(hw)
Dim sr As New StringReader(sw.ToString())
Dim pdfDoc As New Document(PageSize.A2, 10.0F, 10.0F, 10.0F, 0.0F)
Dim htmlparser As New HTMLWorker(pdfDoc)
PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
pdfDoc.Open()
htmlparser.Parse(sr)
pdfDoc.Close()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf")
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Write(pdfDoc)
Response.[End]()
End Using
End Using