Skip to content

v0.8.6 — honest text/table quality

Choose a tag to compare

@Detective-XH Detective-XH released this 29 Jun 22:01
· 25 commits to master since this release
v0.8.6
0ed76ba

v0.8.6 — 2026-06-29

Added

  • Page.Tables() and Reader.Warnings() now flag text drawn through a legacy non-Unicode font — a
    pattern common in South Asian statistical PDFs where script labels (such as Devanagari/Hindi) are
    rendered with fonts like Kruti Dev, DevLys, or Walkman-Chanakya, whose glyphs map to Latin
    characters rather than the intended script. Page.Tables() emits a per-table
    TableWarningLegacyFont (legacy_font_text) code on Table.Warnings when a table's alphabetic
    cell text is predominantly garbled in this way; Reader.Warnings() emits the same
    legacy_font_text code at the document level so consumers of Words(), Lines(), and
    GetPlainText() also receive the signal. The warning is strictly additive — Tables().Cells is
    byte-identical — and tells a caller that the garbled text cannot be recovered on a pure-text path.
  • Page.Words(), Page.Lines(), and Page.Blocks() now omit glyphs from a recurring diagonal
    watermark printed across most pages of a document — for example an agency stamp repeated on every
    page. GoPDF detects a recurring watermark by sampling up to 16 evenly-spaced pages; when the same
    angled-text signature recurs on at least half of them, its glyphs are excluded from word assembly,
    so a value like 11144 no longer arrives fused with watermark characters. Documents without a
    recurring page-spanning watermark are byte-unchanged; Page.Content(), Page.Texts(), and
    DebugJSON always return every glyph unfiltered. Page.Tables() is unaffected and byte-identical
    — it already unconditionally excludes diagonal text from cell content.
  • Page.Tables() now reports per-table quality: each Table carries a Confidence
    (TableConfidence — "high" or "low") and a Warnings slice ([]TableWarning, each with a
    TableWarningCode), so an LLM/RAG consumer can tell a trustworthy grid from a defective one
    without re-reading the page. Confidence is detection-relative: "high" means no quality
    detector flagged the table — not that it is verified correct — so a table may move from "high"
    to "low" in a future release as more detectors are added. The first detector flags a
    phantom_table: a grid whose columns are mostly empty (≥ 60% entirely blank), the signature of a
    bar chart or infographic misread as a ruled table (a genuinely very sparse table can also trip it,
    and the warning text says so). The flag never alters the extracted cells.
  • Page.TableRegions() returns the page-space bounding box of each detected table, 1:1 with
    Page.Tables() by index, so a consumer can locate a low-confidence table on the page (for example
    to crop and re-read it). Boxes are in the same Y-up display space as Page.Words() and
    Page.Content(). These additions do not change the reconstructed grids — Page.Tables().Cells is
    unchanged.

Fixed

  • Page.Tables() now recovers the data rows of "comb-body" tables — a layout, common in statistical
    yearbooks, where the header is ruled into columns but the data body is ruled only with vertical lines
    extending downward (no horizontal row rules and no closing bottom rule). Previously every data value
    fell outside the closed cells and was dropped from the grid, even though Page.Lines() held the data
    and the page rendered correctly. Page.Tables() now synthesizes the data cells at the header's column
    positions across the vertically-ruled data rows, recovering the full grid. False-positive guards ensure
    that non-table layouts — tables of contents, formula and prose blocks, bar charts, and infographic maps
    — are left untouched; Page.Words(), Page.Lines(), and Page.Blocks() are unaffected.
  • Page.Tables() now recovers the data rows of "headers-only" ruled tables — a layout, common in
    statistical yearbooks (e.g. quarterly tables), where the header is ruled into columns but the data body
    is ruled only down the leftmost row-label column. Previously every data value fell outside the closed
    cells and was dropped, so the grid came out with populated headers and entirely empty data columns even
    though Page.Lines() held the data and the page renders correctly. Page.Tables() now synthesizes the
    missing data cells at the header's column positions across the ruled data rows, but only for a column
    whose values recur across two or more rows — so genuinely empty cells stay empty and a lone stray word
    inside the table rectangle (e.g. a footnote) is not promoted to data. Recovery is confined to this
    structural pattern; normally- and partially-ruled tables are left untouched, and Page.Words(),
    Page.Lines(), and Page.Blocks() are unaffected. On tables whose columns are themselves only
    whitespace-separated, the recovered values may land in a single fused column — the data is no longer
    lost, but column splitting there remains a separate limitation.
  • Page.Tables() now reconstructs landscape tables that are embedded on a portrait page via a 90°
    counter-clockwise text matrix — a layout common in statistical yearbooks. Previously the rotation made
    each value extract character-reversed (Birganj→jnagriB, 1130.1→1.0311) and the whole grid came
    out transposed, so the table was unusable even though the page renders correctly. Page.Tables() now
    detects a predominantly-90°-rotated page and remaps it to reading orientation before reconstruction, so
    cells come out de-reversed and in the correct row/column order. The remap is internal to Page.Tables();
    Page.Words(), Page.Lines(), and Page.Blocks() continue to report such text in its raw rotated page
    geometry. On very dense or sparsely-ruled rotated tables the data is recovered in the correct cells but
    the grid may remain imperfect (a long number can be split, or a row flattened), so treat such a grid as
    advisory.
  • Page.Tables() no longer pulls diagonal watermark or rotated chart-label text into table cells. When a
    document carries a watermark printed diagonally across the page, or a chart with slanted axis/arc labels,
    the individual letters are scattered over the page at an angle; where one fell within a data row it was
    absorbed into that table cell — turning a value like 8,9 into G8,98,9, merging adjacent rows, or
    adding a spurious empty column. Page.Tables() now excludes text whose baseline is more than ~10° off an
    axis (horizontal or vertical) from cell content, so diagonal decoration can no longer corrupt the grid.
    Axis-aligned text is always kept, including 90°/270° landscape and vertical tables and headers.
    Page.Words(), Page.Lines(), and Page.Blocks() are unaffected — they still return every glyph,
    including diagonal text — so this narrows only the structured table view. Tables on heavily watermarked
    statistical pages, previously garbled, now extract cleanly.

Verify this release

This tag is signed with the maintainer's 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 the recipe below verifies any release regardless of which key signed it:

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.6
# 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.6 && go mod verify