请参考我免费的 dll 或工具,它可以帮助我将带有 highcharts 的 aspx 页面在页面运行时通过 javascripts 填充转换为 pdf 文件。
Public Sub lnkExport_Click(sender As Object, e As EventArgs) Handles lnkExport.Click Dim attachment As String = "attachment; filename=" & "abc" & ".pdf" Response.ClearContent() Response.AddHeader("content-disposition" , 附件) Response.ContentType = "application/pdf" Dim s_tw As New StringWriter() Dim h_textw As New HtmlTextWriter(s_tw) h_textw.AddStyleAttribute("font-size", "7pt") h_textw.AddStyleAttribute("color", "黑色") MasterDiv.RenderControl(h_textw)
'Name of the Panel
Dim doc As New Document()
doc = New Document(PageSize.A4, 5, 5, 15, 5)
FontFactory.GetFont("Verdana", 80, iTextSharp.text.Color.RED)
PdfWriter.GetInstance(doc, Response.OutputStream)
doc.Open()
Dim s_tr As New StringReader(s_tw.ToString())
Dim html_worker As New HTMLWorker(doc)
html_worker.Parse(s_tr)
doc.Close()
Response.Write(doc)
End Sub
html_worker.Parse(s_tr) is giving error