* Get the document subject. * * @returns The subject, or undefined if not set
()
| 1134 | * @returns The subject, or undefined if not set |
| 1135 | */ |
| 1136 | getSubject(): string | undefined { |
| 1137 | const infoRef = this.ctx.info.trailer.getRef("Info"); |
| 1138 | |
| 1139 | if (!infoRef) { |
| 1140 | return undefined; |
| 1141 | } |
| 1142 | |
| 1143 | const info = this.ctx.registry.getObject(infoRef); |
| 1144 | |
| 1145 | if (!(info instanceof PdfDict)) { |
| 1146 | return undefined; |
| 1147 | } |
| 1148 | |
| 1149 | return info.getString("Subject")?.asString(); |
| 1150 | } |
| 1151 | |
| 1152 | /** |
| 1153 | * Set the document subject. |
no test coverage detected