pdfAddRegion
Add a highlighted region.
PDFRegionHandle pdfAddRegion(PDFViewerHandle viewer, int page,
double x0, double y0, double x1, double y1,
COLORREF color, COLORREF selectColor,
int selectable, char *label)
The XpdfViewer library can display a set of highlighted regions on the
currently open PDF file. Once a highlighted region is created, the
user can manipulate it by selecting it (clicking on it) and then
moving its edges to resize it. As far as the XpdfViewer library is
concerned, highlighted regions are simply rectangles drawn in some
specified color. You can use regions for various purposes, e.g.,
allowing the user to mark parts of a PDF file to be extracted later.
This function adds a new highlighted region. The arguments are:
page
: page number for the regionx0, y0, x1, y1
: corners of the region rectangle, in PDF coordinate spacecolor
: normal colorselectColor
: color to be used when the highlighted region is selected by the userselectable
: if non-zero, the region can be selected and resized by the userlabel
: label for the region (orNULL
for no label)
pdfAddRegion
function returns a handle that can be
passed to the other region-related functions.
C:
int page;
double x0, y0, x1, y1;
PDFRegionHandle region;
/* user requested that the current selection be highlighted */
if (pdfGetCurrentSelection2(viewer, &page, &x0, &y0, &x1, &y1)) {
region = pdfAddRegion(viewer, page, x0, y0, x1, y1,
RGB(0,0,255), RGB(255,0,0), 1, NULL);
}