I want to add highlight annotation into pdf file by using PDFKit. And I use this below code to add it.
PDFPage* page = [self.pdfView.document pageAtIndex:0];
PDFAnnotation* annotation = [[PDFAnnotation alloc] initWithBounds:CGRectMake(206, 600, 60, 59) forType:PDFAnnotationSubtypeHighlight withProperties:nil];
annotation.color = UIColor.blueColor;
[page addAnnotation:annotation];
But it just highlight one rectangle, I want to highlight multiple lines text. I have found one question/answer Wrong highlight annotation on apple PDFKit
But it is not what I want, it will add many highlight annotations, I just want to add one annotation. And I learn that the key-value QuadPoints can do this. But it doesn't work when I add the below code, even can't render the annotation.
NSArray<NSValue *> *quadrilateralPoints = [[NSArray alloc] initWithObjects:
[NSValue valueWithCGPoint:CGPointMake(206.0f, 659.0f)],
[NSValue valueWithCGPoint:CGPointMake(266.0f, 659.0f)],
[NSValue valueWithCGPoint:CGPointMake(206.0f, 600.0f)],
[NSValue valueWithCGPoint:CGPointMake(266.0f, 600.0f)],
nil];
annotation.quadrilateralPoints = quadrilateralPoints;
So now I want to know how to implement it? or how to use quadrilateralPoints ?