Repository navigation
v0.8.2 — table extraction quality + robustness
v0.8.2 — 2026-06-19
Fixed
-
Page.Tables()now recovers row labels whose dot leader is rendered with its glyphs interleaved
into the label text. Some publishers (for example USDA statistical tables) lay out a row label and
its trailing dot leader as overlapping glyphs, so the label arrived fused with filler dots —
Alabamaextracting asAlaba...m...a..... GoPDF now detects this fused-leader signature (a run
of three or more dots flanked by a letter on both sides) and strips the filler dots, recovering
the label. Legitimate data text is left untouched: decimal points, abbreviations such asU.S., a
trailing ellipsis (continued...), and a dot-separated range (1...3) are all preserved. The
change affects onlyPage.Tables()cell text; plain text extraction (Words/Lines) is
unaffected. -
Page.Tables()no longer splits a cell value across adjacent columns when the PDF renders the
token with an embedded zero-advance space — for example a comma-grouped number laid out as
2,1+20(2,120), or a character-spaced word laid out asaddr+ess(address). Such tokens
previously fragmented at the space, with the tail bleeding into the neighbouring cell; GoPDF now
re-joins same-row pieces that abut with no real gap, so the value lands whole in one cell. Two
genuinely distinct values that meet at a ruled cell border are kept apart — the re-join never
crosses a vertical rule — and tables with normal column spacing are byte-for-byte unchanged. -
A font whose
/ToUnicodeCMap is malformed — for example, a stray PostScriptdefkeyword
inside a dictionary literal — no longer empties the entire document. Previously the malformed
CMap raised a parse error that propagated up through font loading and left every page's text
empty; GoPDF now recovers, discards only the broken CMap, and falls back to the same handling as
a font with no/ToUnicode(so Adobe CID and Identity fonts still decode correctly). A new
malformed_tounicodewarning is raised — alongside the existingmissing_tounicode— so the
degraded font stays visible rather than failing silently. A genuine internal fault is still
re-raised rather than being masked as malformed input, and valid PDFs are unaffected. -
Type0 CJK fonts that use
/Encoding /Identity-Hor/Identity-Vwith an Adobe-Japan1 CID
ordering (/Registry (Adobe) /Ordering (Japan1)) and no/ToUnicodeare no longer garbled.
Their 2-byte show-string codes are Adobe-Japan1 CIDs, not Unicode; GoPDF now decodes them through
Adobe's published CID→Unicode table instead of mangling each CID into two replacement characters.
On real Japanese government/academic PDFs this took the U+FFFD replacement-character rate from
~30–46% to 0, recovering coherent Japanese that matches an independent extractor character for
character. Font selection stays byte-identical for every other font: the path requires Type0 +
Identity-H/V + the genuine Adobe registry and ordering + no usable/ToUnicode, so private CID
collections,Identity-ordering fonts, and non-CJK fonts are unaffected. Vertical-writing fonts
still raise the vertical-writing-mode warning (reading order for vertical text is unchanged). The
Adobe-Japan1 mapping data is derived from Adobe'scid2code.txt(BSD-3-Clause; seeNOTICE).
Changed
DocumentSummary'sDecodeRatios.FallbackRationow also counts glyphs decoded through the Adobe
CID→Unicode table described above (it already counted predefined-CMap charset approximations).
Both decode paths share thefallback_encodingwarning, so the ratio and the warning stay
consistent. Documents without such fonts are unaffected.
Verify this release
Signed with an ED25519-SK FIDO2 hardware key:
256 SHA256:duCP4h22hb2oNAZMaFhUlpq0j8+qBbZuaXnS99yUhkY (ED25519-SK)
All of the maintainer's trusted keys are published on the GitHub account, so this recipe verifies the tag regardless of which key signed it — nothing needs to be copied from these notes:
curl -s https://api.github.com/users/Detective-XH/ssh_signing_keys \
| python3 -c "import json,sys; [print('*', k['key']) for k in json.load(sys.stdin)]" > allowed_signers
git -c gpg.ssh.allowedSignersFile=./allowed_signers tag -v v0.8.2
# expect: Good "git" signature for * with ED25519-SK key SHA256:duCP4h22hb2oNAZMaFhUlpq0j8+qBbZuaXnS99yUhkYModule integrity is independently guaranteed by the Go checksum database:
go mod download github.com/Detective-XH/gopdf@v0.8.2 && go mod verify