* Get the document author. * * @returns The author, or undefined if not set
()
| 1099 | * @returns The author, or undefined if not set |
| 1100 | */ |
| 1101 | getAuthor(): string | undefined { |
| 1102 | const infoRef = this.ctx.info.trailer.getRef("Info"); |
| 1103 | |
| 1104 | if (!infoRef) { |
| 1105 | return undefined; |
| 1106 | } |
| 1107 | |
| 1108 | const info = this.ctx.registry.getObject(infoRef); |
| 1109 | |
| 1110 | if (!(info instanceof PdfDict)) { |
| 1111 | return undefined; |
| 1112 | } |
| 1113 | |
| 1114 | return info.getString("Author")?.asString(); |
| 1115 | } |
| 1116 | |
| 1117 | /** |
| 1118 | * Set the document author. |