0
我想解析一个由html表(4列)组成的asp.net面板控件到PD文档。我已经将页面大小设置为A4,并将所有页边距设置为10. 创建PDF时,会有很大的左右边距。我怎样才能得到左边和边缘赖特?iTextSharp忽略新创建的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]()