4

我正在使用 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();
4

1 回答 1

10

它的 Document.NewPage() 函数很容易。

我在其他网站上看到了一些非常奇怪的“解决方案”,希望这对其他人有所帮助。

于 2009-09-23T15:10:47.593 回答