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

Method getSubject

src/api/pdf.ts:1136–1150  ·  view source on GitHub ↗

* Get the document subject. * * @returns The subject, or undefined if not set

()

Source from the content-addressed store, hash-verified

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.

Callers 5

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

Calls 4

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

Tested by

no test coverage detected