【问题标题】:add an image and it span in multiple pages using itextsharp添加图像并使用 itextsharp 跨越多个页面
【发布时间】:2014-02-17 12:39:47
【问题描述】:

如何使用 iTextSharp 添加跨越多个 PDF 页面的大图像。我有一个超过 PDF 页面高度的图像,因此图像没有完全显示在 PDF 页面中。图片的最后一部分丢失了。

【问题讨论】:

  • This answer 展示了如何在 iText/Java 的不同文档页面上显示模板的不同部分。您需要在 iTextSharp/.Net 中为包装图像的模板执行等效操作。

标签: .net image itextsharp


【解决方案1】:

请检查这是否解决了您的问题:

Document oDocument = new Document();
oDocument.Open();
PdfPTable table = new PdfPTable(1);
table.WidthPercentage = 100;
PdfPCell c = new PdfPCell(image, true);
c.Border = PdfPCell.NO_BORDER;
c.Padding = 5;
c.Image.ScaleToFit(750f,750f); /*The new line*/
table.AddCell(c);  // <-- Add the cell to the table
oDocument.Add(table);

我希望使用PDfPTable 可能会解决您的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-12
    • 1970-01-01
    • 2015-04-02
    • 1970-01-01
    • 1970-01-01
    • 2017-11-13
    • 1970-01-01
    相关资源
    最近更新 更多