我正在使用 DirectContent 方法在我的 PDF 上绝对定位元素。 我需要遍历记录列表并在我的 PDF 中为每条记录构建一页。
我如何告诉 itextsharp 插入新页面并“绘制”到该页面?
// 72point per inch
// we want 7x10
iTextSharp.text.Rectangle pageSize = new iTextSharp.text.Rectangle(504, 720);
Document doc = new Document(pageSize);
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(@"C:\temp\backPages.pdf", FileMode.Create));
doc.Open();
PdfContentByte cb = writer.DirectContent;
// "DRAW" IMAGES AND TEXT
...
//various .Add's called here
...
// Done with drawing images & text
doc.Close();
最佳答案
Document.NewPage() 函数很简单。
我在其他网站上看到了一些非常奇怪的“解决方案”,希望这对其他人有帮助。
关于c# - itextsharp : Adding multiple pages,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1460165/