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

Method getOrCreateViewerPreferences

src/api/pdf.ts:1521–1534  ·  view source on GitHub ↗

* Get or create the ViewerPreferences dictionary.

()

Source from the content-addressed store, hash-verified

1519 * Get or create the ViewerPreferences dictionary.
1520 */
1521 private getOrCreateViewerPreferences(): PdfDict {
1522 const catalog = this.ctx.catalog.getDict();
1523 const existing = catalog.getDict("ViewerPreferences", this.ctx.resolve.bind(this.ctx));
1524
1525 if (existing) {
1526 return existing;
1527 }
1528
1529 // Create new ViewerPreferences
1530 const prefs = new PdfDict();
1531 catalog.set("ViewerPreferences", prefs);
1532
1533 return prefs;
1534 }
1535
1536 // ─────────────────────────────────────────────────────────────────────────────
1537 // Object access

Callers 1

setTitleMethod · 0.95

Calls 2

getDictMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected