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

Method addTextAnnotation

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

* Add a text annotation (sticky note). * * @param options - Text annotation options * @returns The created annotation

(options: TextAnnotationOptions)

Source from the content-addressed store, hash-verified

2103 * @returns The created annotation
2104 */
2105 addTextAnnotation(options: TextAnnotationOptions): PDFTextAnnotation {
2106 const annotDict = PDFTextAnnotation.create(options);
2107
2108 // Register and add to page
2109 const annotRef = this.ctx.register(annotDict);
2110 this.addAnnotationRef(annotRef);
2111
2112 // oxlint-disable-next-line typescript/no-unsafe-type-assertion
2113 return createAnnotation(annotDict, annotRef, this.ctx.registry) as PDFTextAnnotation;
2114 }
2115
2116 /**
2117 * Add a line annotation.

Callers 3

mainFunction · 0.80

Calls 4

addAnnotationRefMethod · 0.95
createAnnotationFunction · 0.90
createMethod · 0.65
registerMethod · 0.45

Tested by

no test coverage detected