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

Method getAuthor

src/api/pdf.ts:1101–1115  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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.

Callers 7

getMetadataMethod · 0.95
pdf.test.tsFile · 0.80
mainFunction · 0.80
mainFunction · 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