我有一个图像,我正在将其插入到使用 iTextSharp 和 asp.net 创建的 pdf 文件中。我添加的图像是一个条形码,我需要旋转它,以便它在页面上是纵向而不是横向。有没有办法用 iTextSharp 来做到这一点?
请检查下面的代码以使用 iTextSharp 旋转图像
image.setRotationDegrees(90); // this will rotate the image to 90 degree clockwise
Run Code Online (Sandbox Code Playgroud)
要添加除图像之外的文本,您可以使用从此答案中获取的以下代码
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);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6503 次 |
最近记录: |