Customize Annotation Rendering

There are various ways to customize how an annotation is shown and rendered on the page.

Customize or Hide the Note Icon

A small note icon indicator is displayed next to the actual annotation when it has text attached to it. It can be attached to the annotation either by programmatically setting it via the contents property, or by adding it in the UI via the “Note...” option in the menu.

Annotation Note Icon

The note icon can be customized or completely disabled by subclassing the corresponding class of the annotation type and overriding shouldDrawNoteIconIfNeeded:

Copy
1
2
3
4
5
6
7
class InkAnnotation: PSPDFInkAnnotation {
    override var shouldDrawNoteIconIfNeeded: Bool {
        return false
    }
}

document.overrideClass(PSPDFInkAnnotation.self, with: InkAnnotation.self)
Copy
1
2
3
4
5
6
7
8
9
10
@interface PSCInkAnnotation : PSPDFInkAnnotation @end
@implementation PSCInkAnnotation

- (BOOL)shouldDrawNoteIconIfNeeded {
    return NO;
}

@end

[document overrideClass:PSPDFInkAnnotation.class withClass:PSCInkAnnotation.class];