What is the Android counterpart for document.renderAnnotationTypes from iOS?

Q: What is the Android counterpart for document.renderAnnotationTypes from iOS?

A: The Android counterpart is PdfConfiguration#excludedAnnotationTypes.

Q: How to exclude annotations with excludedAnnotationTypes?

A: Here is how to exclude specific annotation types:

Copy
1
2
// Excludes ink and stamps from rendering
configuration.excludedAnnotationTypes(ArrayList(EnumSet.of(AnnotationType.INK, AnnotationType.STAMP)))
Copy
1
2
// Excludes ink and stamps from rendering
configuration.excludedAnnotationTypes(new ArrayList<>(EnumSet.of(AnnotationType.INK, AnnotationType.STAMP)));

Q: How to exclude all annotation types?

A: Here is how to exclude all annotation types using this configuration option:

Copy
1
2
// Passing all annotation types will exclude all annotations from rendering
configuration.excludedAnnotationTypes(ArrayList(EnumSet.allOf(AnnotationType::class.java)))
Copy
1
2
// Passing all annotation types will exclude all annotations from rendering
configuration.excludedAnnotationTypes(new ArrayList<>(EnumSet.allOf(AnnotationType.class)));

Q: How to include back all annotation types?

A: To include all annotation types you need to pass an empty list into excludedAnnotationTypes:

1
2
// Passing empty list will render ALL annotations
configuration.excludedAnnotationTypes(ArrayList())
1
2
// Passing empty list will render ALL annotations
configuration.excludedAnnotationTypes(new ArrayList<>());