TextExtractor
Linear text extraction (ISO 32000-1 §9.4).
Walks content-stream operations for text-showing operators:
Tj: show a stringTJ: show an array of strings/spacing adjustments': move to next line and show": set spacing, move to next line, and show
Show strings are decoded through the current font (set by Tf), so each font's /Encoding and /ToUnicode CMap apply. This is what makes composite Type 0 fonts (Identity-H, 2-byte codes) and embedded CJK extract correctly rather than byte-for-byte. When no font is resolvable the bytes fall back to PdfString.asText() (PDFDocEncoding / UTF-16BE BOM detection).
Line breaks are inserted on BT/ET, Td, TD, T*, Tm heuristics because PDF text positioning is geometric, not line-based. Those size-scaled heuristics read the Tf size times the Tm scale, since a producer may set Tf to 1 and carry the real size in the matrix.
This is the cheap linear path: it tracks Tm but not cm or the wider graphics stack. PdfPage.structuredText is the precise one.