【问题标题】:itextsharp : Adding multiple pagesitextsharp : 添加多个页面
【发布时间】:2009-09-22 13:39:33
【问题描述】:

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

【问题讨论】:

    标签: c# pdf itextsharp


    【解决方案1】:

    Document.NewPage() 函数很简单。

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

    【讨论】:

      猜你喜欢
      • 2015-04-02
      • 1970-01-01
      • 1970-01-01
      • 2013-05-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-14
      • 1970-01-01
      相关资源
      最近更新 更多