views:

442

answers:

2

I want to create and insert a lot of images into a PDF and iTextSharp looks promising for this. Their tutorial discusses adding a .net Bitmap object to the document, however, the Bitmap they use is one generated from an existing supported image file. Can iTextSharp take a Bitmap object that is directly generated by a graphics object?

Thanks!

A: 

I think you can do it. In their tutorial they say getting image instance from byte array. You can save graphics object to memory stream and pass it to this method:

//public static Image getInstance(byte[] img)
Image img= Image.getInstance(imagebytes);

Here is the tutorial.

TheVillageIdiot
A: 

If the library uses either the Image or the Bitmap class, you can use in-memory bitmaps as well as ones which have been loaded from your hard disk (or wherever else) because .NET treats then uniformly.

Best Regards

Oliver Hanappi