Convert a page to a bitmap in memory.
int pdfConvertPageToBitmap2(PDFHandle pdf, int page, double dpi, int color, int reverseBytes, int rowPad, int upsideDown, PDFImageHeader *imgHdr, char **bits)
This function converts a PDF page to a bitmap in memory. It is similar to pdfConvertPageToBitmap, but offers more control over the output bitmap format, and has an identical API on all platforms.

The arguments are:

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

The pdfImageGrayToMono 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.

The pdfConvertPageToBitmap2 function returns pdfOk if successful, otherwise an error code.

The caller is responsible for freeing the bits pointer after using it, by calling pdfFreeMemory.

int reverseBytes, rowPad, upsideDown; PDFImageHeader hdr; char *bits; reverseBytes = 0; /* RGB ordering */ rowPad = 1; /* no extra padding on rows */ upsideDown = 0; /* store top row first */ pdfConvertPageToBitmap2(pdf, 5, 72, pdfImageRGB, reverseBytes, rowPad, upsideDown, &hdr, &bits); ... pdfFreeMemory(bits);