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

Method getCreationDate

src/api/pdf.ts:1286–1306  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

1284 * @returns The creation date, or undefined if not set or invalid
1285 */
1286 getCreationDate(): Date | undefined {
1287 const infoRef = this.ctx.info.trailer.getRef("Info");
1288
1289 if (!infoRef) {
1290 return undefined;
1291 }
1292
1293 const info = this.ctx.registry.getObject(infoRef);
1294
1295 if (!(info instanceof PdfDict)) {
1296 return undefined;
1297 }
1298
1299 const dateStr = info.getString("CreationDate")?.asString();
1300
1301 if (!dateStr) {
1302 return undefined;
1303 }
1304
1305 return parsePdfDate(dateStr);
1306 }
1307
1308 /**
1309 * Set the document creation 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