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

Method addSquareAnnotation

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

* Add a square (rectangle) annotation. * * @param options - Square annotation options * @returns The created annotation

(options: SquareAnnotationOptions)

Source from the content-addressed store, hash-verified

2137 * @returns The created annotation
2138 */
2139 addSquareAnnotation(options: SquareAnnotationOptions): PDFSquareAnnotation {
2140 const annotDict = PDFSquareAnnotation.create(options);
2141
2142 // Register and add to page
2143 const annotRef = this.ctx.register(annotDict);
2144 this.addAnnotationRef(annotRef);
2145
2146 // oxlint-disable-next-line typescript/no-unsafe-type-assertion
2147 return createAnnotation(annotDict, annotRef, this.ctx.registry) as PDFSquareAnnotation;
2148 }
2149
2150 /**
2151 * Add a circle (ellipse) annotation.

Callers 2

Calls 4

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

Tested by

no test coverage detected