【发布时间】:2023-12-29 20:38:04
【问题描述】:
我正在尝试覆盖 OnEndPage 事件,但我收到错误消息,提示找不到合适的方法来覆盖
public override void OnEndPage(PdfWriter wri, Document doc)
{
PdfPTable table = new PdfPTable(1);
table.TotalWidth = doc.PageSize.Width - doc.LeftMargin - doc.RightMargin;
PdfPTable table2 = new PdfPTable(2);
PdfPCell cell2 = new PdfPCell(new Phrase("Test Top"));
cell2.Colspan = 2;
table2.AddCell(cell2);
cell2 = new PdfPCell(new Phrase("\nTitle", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 16, iTextSharp.text.Font.BOLD | iTextSharp.text.Font.UNDERLINE)));
cell2.HorizontalAlignment = Element.ALIGN_CENTER;
cell2.Colspan = 2;
table2.AddCell(cell2);
PdfPCell cell = new PdfPCell(table2);
table.AddCell(cell);
table.WriteSelectedRows(0, -1, doc.LeftMargin, doc.PageSize.Height - 37, wri.DirectContent);
}
轻轻地依偎在两个按钮调用之间......我做错了什么吗?如果我是,并且如果可能的话,是否可以提供一个包含整个 PDR/Header 生成的完整源代码的示例?我没有运气找到它们,我开始发疯了,哈哈
感谢您的帮助
【问题讨论】:
标签: c# overriding itextsharp