Adding a bitmap that is embedded in the application

Hi all,

I am trying to figure out how to add a bitmap to a page that is embedded in a MFC C++ application. I get a handle to the bitmap using the following code:

HBITMAP hBitmap = ::LoadBitmap(theApp.m_hInstance, MAKEINTRESOURCE(IDB_MMLOGOBMP));

I am not sure what to do to create the image using this handle.

Thank you in advance for you help!


In pdftron.PDF.Image class (on Windows platfroms) there is a static
'Create' method that accepts GDI+ Bitmap. This method is both
available for .NET as well as for C/C++.

So, you could instantiate a GDI+ Bitmap from Win32 HBITMAP and then
pass the resulting GDI+ bitmap to PDFNet.

Another option is to read raw image data from the bitmap (using Win32
APIs) and then pass the normalized data to one of Image.Create()
methods. Please keep in mind that this option is a bit more

Q: I need to also support Windows 98, Me, and 2000. I do not believe
that GDI+ is supported for these Operating Systems.

You mentioned ready the raw image data and passing the normalized data
in to one of the Create methods. Is there an example of that?
A: Assuming that you are developing in C++ you could use the following
code snippet:

const char* image_buf = ...;
Image img = Image::Create(doc, image_buf, width*height, width, height,
8, ColorSpace::CreateDeviceRGB(), Image::e_none);

The above snippet assumes that image_buf is a raw, uncompressed RGB
image buffer.