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]()