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

Method setAppearance

src/annotations/base.ts:398–414  ·  view source on GitHub ↗

* Set an appearance stream by type.

(type: "N" | "R" | "D", stream: PdfStream)

Source from the content-addressed store, hash-verified

396 * Set an appearance stream by type.
397 */
398 private setAppearance(type: "N" | "R" | "D", stream: PdfStream): void {
399 let ap = this.dict.getDict("AP", this.registry.resolve.bind(this.registry));
400
401 if (ap instanceof PdfDict) {
402 // Register the stream and store the reference
403 const streamRef = this.registry.register(stream);
404
405 ap.set(type, streamRef);
406
407 this.markModified();
408
409 return;
410 }
411
412 ap = new PdfDict();
413 this.dict.set("AP", ap);
414 }
415
416 // ─────────────────────────────────────────────────────────────────────────────
417 // Change Tracking

Callers 3

setNormalAppearanceMethod · 0.95
setRolloverAppearanceMethod · 0.95
setDownAppearanceMethod · 0.95

Calls 4

markModifiedMethod · 0.95
getDictMethod · 0.65
registerMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected