Skip to content

PdfPageText ​

Import from: @xbbg/xnews

Defined in: src/pdf.ts (declaration: pdf.d.ts:16)

PDF text extraction, dependency-free.

This reads the text layer; it does not render and it does not OCR. The strategy is deliberately structural rather than xref-driven: real files from these catalogs have broken, hybrid, or stream-based cross-reference tables, so objects are collected by scanning for N G obj … endobj and then expanding every /ObjStm compressed object stream. Two of three sample files from arXiv, BIS, and the Internet Archive carry 30+ object streams, so skipping them would lose most of the document.

Character mapping comes from each font's /ToUnicode CMap when present. Without one, a simple font's bytes are read as WinAnsi and a composite font is reported as lossy rather than silently emitting the wrong glyphs.

Properties ​

page ​

readonly page: number

Defined in: src/pdf.ts (declaration: pdf.d.ts:18)

1-based page number in document order.


text ​

readonly text: string

Defined in: src/pdf.ts (declaration: pdf.d.ts:19)

Last updated:

xbbg is independent open-source software and is not affiliated with, endorsed by, sponsored by, or approved by Bloomberg Finance L.P.