pdfConvertPageToBitmap

Convert a page to a bitmap in memory.
// Windows int pdfConvertPageToBitmap(PDFHandle pdf, int page, double dpi, int color, BITMAPINFOHEADER *dibHdr, char **bits) // Linux, Mac OS X int pdfConvertPageToBitmap(PDFHandle pdf, int page, double dpi, int color, PDFImageHeader *imgHdr, char **bits)
This function converts a PDF page to a bitmap in memory. In the Windows DLL version, this function fills in a BITMAPINFOHEADER struct; in the Linux and Mac OS X versions, it fills in a PDFImageHeader structure.

On all platforms, the other 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.

On Windows, the data returned in bits is stored in bottom-up (upside-down) format, with each line padded to a multiple of 32 bits (standard Windows bitmap format).

On Linux and OS X, the data returned in bits is stored in top-down format, with no line padding. The PDFImageHeader struct contains the following fields:

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

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

C (Windows):
BITMAPINFOHEADER hdr; char *bits; /* convert page 5 to a 72 dpi color bitmap */ pdfConvertPageToBitmap(pdf, 5, 72, pdfImageRGB, &hdr, &bits); ... pdfFreeMemory(bits);
C (Linux, OS X):
PDFImageHeader hdr; char *bits; /* convert page 5 to a 72 dpi color bitmap */ pdfConvertPageToBitmap(pdf, 5, 72, pdfImageRGB, &hdr, &bits); ... pdfFreeMemory(bits);
pdfWritePageBitmap
pdfConvertPageToBitmap2
pdfConvertPageToBitmap3
pdfConvertRegionToBitmap
pdfConvertRegionToBitmap2
pdfConvertRegionToBitmap3