Repository navigation
v0.8.3 — per-cell-grid table reconstruction & composite-font glyph placement
v0.8.3 — 2026-06-21
Added
-
Page.Tables()now merges the interleaved blank columns that appear when a stroke-free
per-cell-grid table's rules sub-divide each logical column into a wide (header-bearing) cell nested
with a narrow (data) cell. Such a table reconstructs with roughly twice its real column count — the
header label landing in one grid column and its data in the adjacent one (a header read with no data,
and data read with no header). GoPDF now merges each such nested pair back into a single column,
realigning the header with its data. The merge is conservative and loss-free: it fires only when the
two columns share a right wall (the nested sub-cell signature, not an ordinary column boundary), never
hold content in the same row (so no cell is ever overwritten), and one column is a sparse header while
the other is a dense data column (so two genuine data columns are never merged, and a small table is
not collapsed). It was validated against the nested-sub-cell signature by unit tests; every ruled,
rect-bordered, and previously-handled table is byte-for-byte unchanged, and reconstruction remains
best-effort per thePage.Tables()documentation. -
Page.Tables()now also recovers the rows of dense per-cell-grid statistical tables in which many
stacked records had collapsed into a single tall cell (every value for a column landing in one row).
Common in stroke-free government statistics — for example Japanese MHLW wage tables and US Census trade
releases — GoPDF now splits that cell into its separate records. The split is conservative: it fires only
where the would-be rows carry numeric values across two or more columns (so a wrapped multi-line label, a
column header, or a footnote line is left intact), and only for a genuinely stacked block of several rows.
It was validated against a blind-authored held-out wage-table fixture, where the recovered rows match the
printed table. Known limitations: a multi-row block of numeric column headers, or a non-tabular text block
(a cover page, a table of contents, or running prose) that reaches this reconstruction path, can be
over-split. Every ruled, rect-bordered, and previously-handled table is byte-for-byte unchanged, and
reconstruction remains best-effort per thePage.Tables()documentation. -
Page.Tables()now recovers the columns of dense per-cell-grid statistical tables whose numeric
columns previously collapsed into a single cell per row. In many stroke-free statistical tables — common
in non-US government statistics, for example German Destatis and Taiwan DGBAS releases — the data band
closed as one wide cell, so every figure in a row landed in the same column; GoPDF now splits that cell
at the table's own vertical column rules, restoring the separate columns (measured against a blind-authored
German insolvency regression fixture, the great majority of data cells now land in the right column). The split is conservative:
it fires only at column boundaries the table itself establishes elsewhere (so a rule from a different
table on the page cannot mis-split a cell) and only when the cell's own content actually spans those
columns (so a spanning label or merged-header title is left intact). Every ruled, rect-bordered, and
previously-handled table is byte-for-byte unchanged, and reconstruction remains best-effort per the
Page.Tables()documentation. -
Page.Tables()now reconstructs fill-banded "staircase" tables — statistical tables whose rows
are separated by alternating background shading (filled rectangles) rather than ruled lines, drawn as
a staircase of nested fills that share a common bottom edge (for example U.S. EIA Annual Energy Review
energy-price tables). Such a table previously collapsed to roughly two-thirds of its rows — the lattice
closed one cell per shading step and fused the rows that share a step — and GoPDF now splits those bands
back into individual rows and columns, recovering the full grid. Detection is deliberately conservative:
it requires the nested-fill staircase signature, so bar/column charts, shaded callout boxes, and shaded
prose are not promoted to tables, and every other table (ruled, rect-bordered, or borderless) is
byte-for-byte unchanged. Banded reconstruction remains best-effort (per thePage.Tables()
documentation) — this covers the common-bottom staircase style; other banded layouts may still yield an
incomplete grid. -
Page.Tables()now also reconstructs the opposite banded style — dense per-cell-grid tables drawn
with one filled rectangle per cell and no ruled lines (for example U.S. BEA Survey of Current
Business GDP tables). Such a table's grid already closes on its own, but the page's title and footnote
banners were swept in as extra phantom rows; GoPDF now restricts the result to the table's multi-column
data body, dropping those banner rows and recovering the intended grid. Trimming is conservative: a row
is removed only when it is a single full-width banner lying outside the data body — a real multi-column
row is never dropped, even when blank — and a genuine table with no phantom banners is left byte-for-byte
unchanged. As above, banded reconstruction is best-effort; cell values in these tables can still be
limited by a separate word-spacing issue when adjacent numeric columns are laid out with no real gap
between them.
Fixed
Page.Words(),Page.Tables(), andPage.Content()now place glyphs correctly for composite
(Type0) CIDFonts whose default glyph width (/DW) is zero — a quirk of some
Microsoft-Office-exported PDFs (for example a bold Cambria heading font). Such a font advances
every glyph by zero, so a whole label stacked at one position and the geometry-sorted extractors
read it scrambled —Personal consumption expenditurescame out as
esxpendituronsumption eersonal cP. GoPDF now reads the font's per-CID width array (/W) for these
zero-/DWfonts, so the glyphs are spaced and the label reads in order. Fonts with a normal
(non-zero)/DWare unchanged, andGetPlainText— which reads in stream order and never used
glyph widths — was already correct and is byte-for-byte unaffected.
Verify this release
This tag is signed with an ED25519-SK FIDO2 hardware key:
256 SHA256:duCP4h22hb2oNAZMaFhUlpq0j8+qBbZuaXnS99yUhkY (ED25519-SK)
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.3
# expect: Good "git" signature for * with ED25519-SK key SHA256:duCP4h22hb2oNAZMaFhUlpq0j8+qBbZuaXnS99yUhkYModule integrity:
go mod download github.com/Detective-XH/gopdf@v0.8.3 && go mod verify