Asp.net 使用ITextSharp生成支票状结构的Pdf

Asp.net 使用ITextSharp生成支票状结构的Pdf,asp.net,pdf-generation,itextsharp,Asp.net,Pdf Generation,Itextsharp,我有网上支票生成的要求。 我在用 using iTextSharp.text; using iTextSharp.text.pdf; 我有动态支票的高度和宽度,字体和字体大小。 很明显,在文件的所有页面上都有带有账户信息的支票号码 我的代码是这样的 Document doc = new Document(new Rectangle(width, height), 0, 0, 0, 0); string path = Server.MapPath("~/REPORTFILES"

我有网上支票生成的要求。 我在用

using iTextSharp.text;
using iTextSharp.text.pdf;
我有动态支票的高度和宽度,字体和字体大小。 很明显,在文件的所有页面上都有带有账户信息的支票号码

我的代码是这样的

Document doc = new Document(new Rectangle(width, height), 0, 0, 0, 0);
string path = Server.MapPath("~/REPORTFILES");
var writer = PdfWriter.GetInstance(doc, new FileStream(path + "/cheque.pdf",FileMode.Create));
doc.Open();
BaseFont f_cn = BaseFont.CreateFont("c:\\windows\\fonts\\calibri.ttf", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
for (int i = fromchq; i <= tochq; i++)
            {
            PdfContentByte cb = writer.DirectContent;
            cb.BeginText();
            cb.SetFontAndSize(f_cn, 14);
            cb.SetFontAndSize(f_cn, fontsize);
            cb.SetTextMatrix(cord_x, cord_y);
            cb.ShowText(getProperty(propertyName,i.ToString().PadLeft(FromChqNo.Length, '0')));
            cb.EndText();
            doc.NewPage();
}
Document doc=新文档(新矩形(宽度、高度)、0、0、0);
字符串路径=Server.MapPath(“~/REPORTFILES”);
var writer=PdfWriter.GetInstance(doc,新文件流(path+“/check.pdf”,FileMode.Create));
doc.Open();
BaseFont f_cn=BaseFont.CreateFont(“c:\\windows\\fonts\\calibri.ttf”,BaseFont.CP1252,BaseFont.NOT_EMBEDDED);

对于(int i=fromchq;i所以你正在制作一个多页PDF,这是可行的,对吗?当你试图将这些多页合并成一个单独的页面打印时,它只能在一页上打印3页而不是4页?这是问题吗?Chris sory回答晚了。我终于找到了解决方案。以上所有工作都很好,我做了额外的打印机设置。使用自定义页面选项。