【发布时间】:2016-08-24 14:47:13
【问题描述】:
我打算使用 iTextsharp 创建发票,在我的发票中,它由 3 个部分组成,分别是
- 页面顶部的表格(包括所有供应商信息)
- gridview(购买项目)
- 签名部分(仅在发票最后一页)
到目前为止,我使用 Pdfptable + splitlate 完成了 gridview 部分
PdfPTable table = new PdfPTable(gv.Columns.Count);
table.AddCell(new PdfPCell(new Phrase(cellText, fontH1)));
...
...
//create PDF document
Document pdfDoc = new Document(PageSize.A4, -30, -30, 15f, 15f);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
pdfDoc.Add(table);
pdfDoc.Close();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;" + "filename=GridViewExport.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(pdfDoc);
Response.End();
但我不知道如何在每一页上插入表格。我打算使用 html 表格,因为它需要控制很多东西,比如差异供应商、地址、显示/隐藏或取消图像。请帮忙。
【问题讨论】: