* Get the document modification date. * * @returns The modification date, or undefined if not set or invalid
()
| 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. |
no test coverage detected