pdfGetAnnotContent
Get the content of an annotation.
char *pdfGetAnnotContent(PDFAnnotHandle annot, int *length)
This function returns the "content" of an annotation (whose handle was
obtained with
pdfOnAnnot
). Only some annotation types have
content; pdfGetAnnotContent
will return NULL for
annotations that don't have content.
A string is returned, and *length
is filled in with the
string length. The string will be zero-terminated, but it may contain
zero bytes, depending on the current text encoding (see
pdfSetTextEncoding
). The caller is responsible for freeing the
string (if non-NULL) with the pdfFreeMemory
function.
C:
void mouseDownCbk(void *data, int button, int shift, int page, double x, double y) {
PDFAnnotHandle annot;
char *type, *content;
int contentLength;
annot = pdfOnAnnot(viewer, page, x, y);
type = pdfGetAnnotType(annot);
if (!strcmp(type, "Text")) {
content = pdfGetAnnotContent(annot, &contentLength);
/* ... display the popup text annotation content ... */
pdfFreeMemory(content);
}
}