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

Method getTrapped

src/api/pdf.ts:1368–1388  ·  view source on GitHub ↗

* Get the document trapped status. * * @returns The trapped status, or undefined if not set

()

Source from the content-addressed store, hash-verified

1366 * @returns The trapped status, or undefined if not set
1367 */
1368 getTrapped(): TrappedStatus | undefined {
1369 const infoRef = this.ctx.info.trailer.getRef("Info");
1370
1371 if (!infoRef) {
1372 return undefined;
1373 }
1374
1375 const info = this.ctx.registry.getObject(infoRef);
1376
1377 if (!(info instanceof PdfDict)) {
1378 return undefined;
1379 }
1380
1381 const trapped = info.getName("Trapped")?.value;
1382
1383 if (trapped === "True" || trapped === "False" || trapped === "Unknown") {
1384 return trapped;
1385 }
1386
1387 return undefined;
1388 }
1389
1390 /**
1391 * Set the document trapped status.

Callers 5

getMetadataMethod · 0.95
pdf.test.tsFile · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 3

getObjectMethod · 0.65
getNameMethod · 0.65
getRefMethod · 0.45

Tested by

no test coverage detected