pdfConvertRegionToBitmap2

Convert a region of a page to a bitmap.
int pdfConvertRegionToBitmap2(PDFViewerHandle viewer, int page, double x0, double y0, double x1, double y1, double dpi, int color, BITMAPINFOHEADER *dibHdr, char **bits)
This function converts the specified rectangular region of a page to a bitmap, at the specified resolution (dpi, in dots per inch).

The x0, y0 and x1, y1 arguments are the corners of the rectangle, in PDF coordinates.

The color argument must be one of the following:

The 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 page; double x0, y0, x1, y1; BITMAPINFOHEADER dibHdr; char *bits; int err; if (pdfGetCurrentSelection2(viewer, &page, &x0, &y0, &x1, &y1)) { err = pdfConvertPageToBitmap2(viewer, page, x0, y0, x1, y1, 120, pdfImageRGB, &dibHdr, &bits); if (err == pdfOk) { /* use the returned header (dibHdr) and data (bits) */ ... pdfFreeMemory(bits); } else { /* error ... */ } }
pdfConvertPageToBitmap2
pdfFreeMemory