Question
How to get color of annotations
In the program for the selected fragment, I create an annotation,
I set the color of the annotation using the PDAnnotSetColor method.
The fragment is painted in the desired color. Next, I need to look at all the annotations created on the page and determine their color. I wrote this code:
int numAnnots = PDPageGetNumAnnots(pdPage);
for (int i = 0; i < numAnnots; i++) {
PDAnnot pdAnnot = PDPageGetAnnot(pdPage, i);
if (PDAnnotGetSubtype(pdAnnot) == ASAtomFromString("Highlight")) {
PDColorValue pdColorValue;
if (PDAnnotGetColor(pdAnnot, pdColorValue)) {
if (pdColorValue->space == PDDeviceRGB) {
ASFixed red = pdColorValue->value[0];
ASFixed green = pdColorValue->value[1];
ASFixed blue = pdColorValue->value[2];
double value1 = ASFixedToFloat(red);
double value2 = ASFixedToFloat(green);
double value3 = ASFixedToFloat(blue);
}
}
}
}but an exception is thrown in the statement if (PDAnnotGetColor (pdAnnot, pdColorValue)). Where am I wrong?
