itextsharp 和图像旋转

itextsharp and image rotation

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

请检查以下代码以使用 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);