【问题标题】:itextsharp and image rotationitextsharp 和图像旋转
【发布时间】:2015-06-18 11:01:51
【问题描述】:

我有一张图片,我正在将其插入到我使用 iTextSharp 和 asp.net 创建的 pdf 文件中。我添加的图像是我需要旋转的条形码,以便它在页面上是纵向而不是横向。有没有办法用 iTextSharp 做到这一点。

【问题讨论】:

标签: asp.net pdf itextsharp


【解决方案1】:

请检查以下代码以使用 iTextSharp 旋转图像

image.setRotationDegrees(90); // this will rotate the image to 90 degree clockwise

要在图片之外添加文字,您可以使用以下代码,取自this answer

Image image = Image.GetInstance(imagePath);  
Paragraph p = new Paragraph();
p.Add(new Phrase("Text next to the image "));
p.Add(new Chunk(image, 0, 0));
p.Add(new Phrase(" and text after the image.")); 
document.Add(p);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-03
    相关资源
    最近更新 更多