Customize Annotation Rendering

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

Hide the Note Icon

A small note icon indicator is displayed next to the actual annotation when it has a 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

You can customize this and disable the note icon by subclassing the corresponding class of the annotation type where this should be disabled and then overriding and disabling [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];