Doc AddImageBitmap Function. Adds a System.Drawing.Bitmap to the current page. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

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

 

   
Syntax  

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

[Visual Basic]
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.

 

   

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