我想将一个由 html 表(有 4 列)组成的 asp.net 面板控件解析为 PD 文档。我已将 Pagesize 设置为 A4,所有边距设置为 10。创建我的 pdf 时,左右边距非常大。我怎样才能得到左边和边距?
这是使用的代码:
Dim strFileName = "CBB_" & lblZoekCriteria.Text & ".pdf"
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=" & strFileName)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim sw As New StringWriter()
Dim hw As New HtmlTextWriter(sw)
'Me.Page.RenderControl(hw)
pnlProtestInfo.RenderControl(hw)
Dim sr As New StringReader(sw.ToString())
Dim pdfDoc As New Document(PageSize.A4, 10, 10, 10, 10)
Dim htmlparser As New HTMLWorker(pdfDoc)
PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
pdfDoc.Open()
htmlparser.Parse(sr)
pdfDoc.Close()
Response.Write(pdfDoc)
Response.[End]()