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

Method parseFullObjectAt

src/parser/brute-force-parser.ts:419–434  ·  view source on GitHub ↗

* Parse the full object (including streams) at the given byte offset. * Used for object stream parsing where we need the stream data.

(offset: number, objNum: number, genNum: number)

Source from the content-addressed store, hash-verified

417 * Used for object stream parsing where we need the stream data.
418 */
419 private parseFullObjectAt(offset: number, objNum: number, genNum: number): PdfStream | null {
420 try {
421 const parser = new IndirectObjectParser(this.scanner);
422 const result = parser.parseObjectAt(offset);
423
424 if (result.value instanceof PdfStream) {
425 return result.value;
426 }
427
428 return null;
429 } catch (error) {
430 const message = error instanceof Error ? error.message : String(error);
431 this.warnings.push(`Failed to parse object ${objNum} ${genNum} as stream: ${message}`);
432 return null;
433 }
434 }
435
436 /**
437 * Find object streams among the scanned entries and extract their contents.

Callers 1

Calls 2

parseObjectAtMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected