getDeviceNBitmap

Get a raw bitmap for one DeviceN color channel.
getDeviceNBitmap([in] int channelIdx, [out] int *width, [out] int *height, [out] int *stride, [out, retval] HGLOBAL *data)
This function retrieves a raw bitmap for the specified channel generated by the last call to convertPageToDeviceNImage. It is identical to getDeviceNPicture, except that it returns a raw bitmap instead of an OLE IPicture object.

The bitmap will be an 8-bit grayscale bitmap, indicating the level of the specific colorant at each pixel.

width, height, and stride are output arguments that provide the bitmap width, height, and stride (bytes per row).

The channel bitmaps returned by getDeviceNBitmap will all have the same width and height.

NB: The returned value is an HGLOBAL (i.e., XpdfRasterizer allocates it with GlobalAlloc), and the caller is responsible for calling GlobalFree (or Marshal.FreeHGBlobal) to free it.

C#:
rast.convertPageToDeviceNImage(page, dpi); nChannels = rast.getNumDeviceNChannels(); for (int i = 0; i < nChannels; ++i) { int width, height, stride; IntPtr bitmapData = rast.getDeviceNBitmap(i, out width, out height, out stride); Bitmap bmp = new Bitmap(width, height, stride, PixelFormat.Format8bppIndexed, bitmapData); // ... use bmp ... Marshal.FreeHGlobal(bitmapData); } rast.clearDeviceNImage();
getDeviceNPicture
convertPageToDeviceNImage
getNumDeviceNChannels
getDeviceNChannelName
getDeviceNChannelCMYK
clearDeviceNImage