2

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

Image jpg** = Image.GetInstance(new Uri(URL))
Pandian
  • 8,848
  • 2
  • 23
  • 33
user1661868
  • 31
  • 2
  • 3
  • 7

2 Answers2

1

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/

Raman
  • 1,336
  • 10
  • 13
0

You can try this

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

Image image = Image.GetInstance(ImageStream);

Nimmi
  • 680
  • 8
  • 18