Skip to content

v0.8.2 — table extraction quality + robustness

Choose a tag to compare

@Detective-XH Detective-XH released this 19 Jun 18:35
· 78 commits to master since this release
v0.8.2
dcd3118

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 —
    Alabama extracting as Alaba...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 as U.S., a
    trailing ellipsis (continued...), and a dot-separated range (1...3) are all preserved. The
    change affects only Page.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 as addr+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 /ToUnicode CMap is malformed — for example, a stray PostScript def keyword
    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_tounicode warning is raised — alongside the existing missing_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-H or /Identity-V with an Adobe-Japan1 CID
    ordering (/Registry (Adobe) /Ordering (Japan1)) and no /ToUnicode are 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's cid2code.txt (BSD-3-Clause; see NOTICE).

Changed

  • DocumentSummary's DecodeRatios.FallbackRatio now also counts glyphs decoded through the Adobe
    CID→Unicode table described above (it already counted predefined-CMap charset approximations).
    Both decode paths share the fallback_encoding warning, 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+qBbZuaXnS99yUhkY

Module integrity is independently guaranteed by the Go checksum database:

go mod download github.com/Detective-XH/gopdf@v0.8.2 && go mod verify