Vb.net iTextSharp定制纸张尺寸
我正在使用iTextsharp库创建PDF文件。我可以这样声明A4景观纸:Vb.net iTextSharp定制纸张尺寸,vb.net,itextsharp,Vb.net,Itextsharp,我正在使用iTextsharp库创建PDF文件。我可以这样声明A4景观纸: Dim pdfTable As New PdfPTable(9) pdfTable.WidthPercentage = 100 Dim pdfDoc As New Document(PageSize.A4.Rotate()) 我想知道如何手动设置pdfTable或A4高度。因为底部还有很多空白,我需要在空白处放一些文字。现在,我在底部放了一行文字,这行文字被推到了新的页面 问题1:如何覆盖iTextsharp提供的A
Dim pdfTable As New PdfPTable(9)
pdfTable.WidthPercentage = 100
Dim pdfDoc As New Document(PageSize.A4.Rotate())
我想知道如何手动设置pdfTable或A4高度。因为底部还有很多空白,我需要在空白处放一些文字。现在,我在底部放了一行文字,这行文字被推到了新的页面
问题1:如何覆盖iTextsharp提供的A4纸的高度
问题2:如何创建自定义尺寸的纸张,例如宽度=29厘米,高度=22厘米
谢谢。您可以使用自定义PdfpageEvent向页脚添加文本、表格或其他内容 下面是一些将4列表添加到页脚的代码(很抱歉,它是C#): 这是调用上述代码的代码:
var pdfWriter = PdfWriter.GetInstance(pdf, new FileStream(fileName, FileMode.Create));
pdfWriter.PageEvent = new CustomPdfPageEvent();
iTextSharp中的自定义页面大小:
Dim pgSize As New iTextSharp.text.Rectangle(myWidth, myHeight)
Dim doc As New iTextSharp.text.Document(pgSize, leftMargin, rightMargin, topMargin, bottomMargin)
iTextSharp每英寸使用72像素,因此如果您知道所需页面大小的高度和宽度(以英寸为单位),只需将这些数字乘以72即可得到myWidth和myHeight。Hi,我现在将Dim pdfDoc等参数添加为新文档(PageSize.A4.Rotate(),15,35,15,3)。我也会试试你的建议。
Dim pgSize As New iTextSharp.text.Rectangle(myWidth, myHeight)
Dim doc As New iTextSharp.text.Document(pgSize, leftMargin, rightMargin, topMargin, bottomMargin)