pdfConvertPageToBitmap2
Convert a page to a bitmap.
int pdfConvertPageToBitmap2(PDFViewerHandle viewer, int page, double dpi, int color,
BITMAPINFOHEADER *dibHdr, char **bits)
This function converts the specified page to a bitmap, at the
specified resolution (
dpi
, in dots per inch).
The color
argument must be one of the following:
pdfImageMono
: monochrome (1 bit per pixel)pdfImageGray
: grayscale (8 bits per pixel)pdfImageRGB
: RGB color (24 bits per pixel)pdfImageDevNToRGB
: 8-bit RGB, rasterized in DeviceN and then converted to RGBpdfImageGrayToMono
: 1-bit monochrome, rasterized in 8-bit grayscale and then converted to 1-bit
dibHdr
argument points to a BITMAPINFOHEADER object
that must be allocated by the caller.
The bits
argument returns a pointer to the image data.
The caller is responsible for freeing this with pdfFreeMemory
.
C:
int p, dpi;
BITMAPINFOHEADER dibHdr;
char *bits;
int err;
p = 1; /* convert page 1 */
dpi = 120; /* 120 dots per inch */
err = pdfConvertPageToBitmap2(viewer, p, dpi, pdfImageRGB, &dibHdr, &bits);
if (err == pdfOk) {
/* use the returned header (dibHdr) and data (bits) */
...
pdfFreeMemory(bits);
} else {
/* error ... */
}