user1661868
user1661868

Reputation: 31

How to add image file in pdf using itext in asp.net

how to add image file with itextSharp in asp.net C#. And which namespace is required

Image jpg** = Image.GetInstance(new Uri(URL))

Upvotes: 2

Views: 3427

Answers (2)

Nimmi
Nimmi

Reputation: 680

You can try this

using(Stream ImageStream = new FileStream(imageUrl, FileMode.Open, FileAccess.Read, FileShare.Read))

Image image = Image.GetInstance(ImageStream);

Upvotes: 0

Raman
Raman

Reputation: 1376

You can use iTextSharp.text.Image for adding images. Something like this:

iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(image, System.Drawing.Imaging.ImageFormat.Jpeg);
myDocument.Add(pic);

Where myDocument is the object of Document Class of itextsharp

Here if one details article which discuss handling images in itextsharp

http://www.mikesdotnetting.com/Article/87/iTextSharp-Working-with-images

and may be you might be interested in going through documentation also, so here is the link:

http://sourceforge.net/projects/itextsharp/

Upvotes: 1

Related Questions