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

Method getModificationDate

src/api/pdf.ts:1327–1347  ·  view source on GitHub ↗

* Get the document modification date. * * @returns The modification date, or undefined if not set or invalid

()

Source from the content-addressed store, hash-verified

1325 * @returns The modification date, or undefined if not set or invalid
1326 */
1327 getModificationDate(): Date | undefined {
1328 const infoRef = this.ctx.info.trailer.getRef("Info");
1329
1330 if (!infoRef) {
1331 return undefined;
1332 }
1333
1334 const info = this.ctx.registry.getObject(infoRef);
1335
1336 if (!(info instanceof PdfDict)) {
1337 return undefined;
1338 }
1339
1340 const dateStr = info.getString("ModDate")?.asString();
1341
1342 if (!dateStr) {
1343 return undefined;
1344 }
1345
1346 return parsePdfDate(dateStr);
1347 }
1348
1349 /**
1350 * Set the document modification date.

Callers 6

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

Calls 5

parsePdfDateFunction · 0.90
asStringMethod · 0.80
getObjectMethod · 0.65
getRefMethod · 0.45
getStringMethod · 0.45

Tested by

no test coverage detected