MCPcopy Create free account
hub / github.com/LibPDF-js/core / removeAnnotations

Method removeAnnotations

src/api/pdf-page.ts:2285–2297  ·  view source on GitHub ↗

* Remove annotations from the page. * * Without options, removes all annotations (except Widget annotations). * With type filter, removes only annotations of the specified type. * * @param options - Optional filter by annotation type * * @example * ```typescript * // Remov

(options?: RemoveAnnotationsOptions)

Source from the content-addressed store, hash-verified

2283 * ```
2284 */
2285 removeAnnotations(options?: RemoveAnnotationsOptions): void {
2286 const annotations = this.getAnnotations();
2287
2288 let toRemove = annotations;
2289
2290 if (options?.type) {
2291 toRemove = annotations.filter(a => a.type === options.type);
2292 }
2293
2294 for (const annotation of toRemove) {
2295 this.removeAnnotation(annotation);
2296 }
2297 }
2298
2299 /**
2300 * Flatten all annotations on this page into static content.

Callers

nothing calls this directly

Calls 2

getAnnotationsMethod · 0.95
removeAnnotationMethod · 0.95

Tested by

no test coverage detected