Adds a Bitmap to the current page.

 

   

Syntax
 

[C#]
virtual int AddImageBitmap(System.Drawing.Bitmap bm, bool transparent)

[Visual Basic]
Overridable Function AddImageBitmap(bm As System.Drawing.Bitmap, transparent As Boolean) As Integer

Throws Exceptions may throw Exception()

 

   

Params
 
Name Description
bm

A .NET Bitmap to be added to the page.

transparent

Whether transparency information should be preserved.

return The ID of the newly added Image Object.

 

   

Notes
 

Adds a System.Drawing.Bitmap to the current page.

If the Transparent parameter is set to true then any transparency information will be preserved. This allows you to add formats such as transparent GIF and PNG with alpha channel.

The image is scaled to fill the current Rect. It is transformed using the current Transform.

If the width or height of the current rectangle is zero the image is auto-sized. If you are working in TopDown mode the image is positioned with its top left pinned at the location indicated by the rectangle. If you are not in TopDown mode the bottom left of the image is pinned at the location indicated by the rectangle. In both cases the natural dimensions of the supplied image are used to determine the displayed width and height resulting in a 72 dpi output.

 

   

Example
 

The following code adds a transparent PNG to a document.

[C#]
Doc theDoc = new Doc();
string thePath = Server.MapPath("../mypics/mypic.png");
Bitmap bm = new Bitmap(thePath);
theDoc.Rect.Inset(20, 20);
theDoc.Color.String = "0 0 200";
theDoc.FillRect();
theDoc.AddImageBitmap(bm, true);
bm.Dispose();
theDoc.Save(Server.MapPath("docaddimagebitmap.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
Dim thePath As String = Server.MapPath("../mypics/mypic.png")
Dim bm As Bitmap = New Bitmap(thePath)
theDoc.Rect.Inset(20, 20)
theDoc.Color.String = "0 0 200"
theDoc.FillRect()
theDoc.AddImageBitmap(bm, True)
bm.Dispose()
theDoc.Save(Server.MapPath("docaddimagebitmap.pdf"))
theDoc.Clear()


docaddimagebitmap.pdf