Sheena Weber
Sheena Weber

Reputation: 53

itextsharp and image rotation

I have an image that I am inserting into a pdf file that I am creating with iTextSharp and asp.net. The image that I have added is a barcode that I need to rotate so that it is portrait instead of landscape on the page. Is there any way to do this with iTextSharp.

Upvotes: 1

Views: 6830

Answers (1)

Nishant Solanki
Nishant Solanki

Reputation: 2128

Please check below code to rotate image using iTextSharp

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

to add text besides image you can use below code taken from 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);

Upvotes: 5

Related Questions