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

Method extract

src/text/text-extractor.ts:49–58  ·  view source on GitHub ↗

* Extract all text from a content stream. * * @param contentBytes - The raw content stream bytes * @returns Array of extracted characters with positions

(contentBytes: Uint8Array)

Source from the content-addressed store, hash-verified

47 * @returns Array of extracted characters with positions
48 */
49 extract(contentBytes: Uint8Array): ExtractedChar[] {
50 const parser = new ContentStreamParser(contentBytes);
51 const { operations } = parser.parse();
52
53 for (const op of operations) {
54 this.processOperation(op);
55 }
56
57 return this.chars;
58 }
59
60 /**
61 * Process a single content stream operation.

Callers 1

extractTextMethod · 0.95

Calls 2

parseMethod · 0.95
processOperationMethod · 0.95

Tested by

no test coverage detected