convertPageToBitmap2

Convert a page to a raw bitmap.
convertPageToBitmap2([in] int page, [in] double hDPI, [in] double vDPI, [in] int color, [out] int *width, [out] int *height, [out] int *stride, [out, retval] HGLOBAL *data)
This function converts a PDF page to a raw bitmap. It is identical to convertPageToPicture2, except that it returns a raw bitmap instead of an OLE IPicture object.

The arguments are:

Note that the color settings are read-only properties on the COM component, so you'll need to use pdf.imageMono, etc.

The imageDevNToRGB mode produces RGB output like imageRGB, but does the rasterization in DeviceN (CMYK + spot colors) so overprint previews will be more accurate.

The imageDevNToCMYK mode produces CMYK output like imageCMYK, but does the rasterization in DeviceN (CMYK + spot colors) so overprint previews will be more accurate.

The imageGrayToMono mode does the rasterization in 8-bit grayscale and converts to 1-bit monochrome at the end. This is useful for files that use transparency – because 1-bit monochrome mode doesn't support transparency.

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#:
int width, height, stride; IntPtr bitmapData = pdf.convertPageToBitmap2(5, 120, 120, pdf.imageRGB, out width, out height, out stride); Bitmap bmp = new Bitmap(width, height, stride, PixelFormat.Format24bppRgb, bitmapData); // ... use bmp ... Marshal.FreeHGlobal(bitmapData);
convertPageToPicture2
convertRegionToBitmap2