github razvandimescu/gopdf v0.13.0
v0.13.0: tables found per region, text with its layout

one hour ago

release fractal

๐ŸŒ€ Release fingerprint โ€” v0.12.0..v0.13.0

11 commits ยท 1 contributor(s) ยท +3077/-846 across 20 files ยท 2026-12-05 โ†’ 2026-12-05

๐ŸŽจ Generated from this release's commit signal โ€” how it's made โ†’

Auto-detected tables are found per region of the page instead of across the whole page, and gopdf tables picks its header row by the data under it. LayoutText renders a page with its columns and rows in place.

Table auto-detection

Measured on the ICDAR 2013 table set (125 PDFs) with the harness in pdfgrab's bench/icdar2013, before and after #59:

before after
Page.Tables(), F1 per document 0.281 0.749
gopdf tables, F1 per document 0.255 0.518
Documents scoring 0, Page.Tables() / gopdf tables 55 / 52 3 / 23
  • Columns are found per region. Gap detection traces whitespace corridors within each block of rows, so a small table on a page of text is found and an empty cell no longer merges two columns. A table splits where its column layout changes, rotated text is left out, and candidates made of running text are rejected.
  • Two-column tables of labels and figures are found when MinColumns is unset.
  • Page.Tables() reads each table again the way FindTableAcrossPages does, so wrapped lines join their row and the header row joins the table. It also reads the lines no table covers. On the README's sample statement it now returns the same rows as gopdf tables.
  • gopdf tables picks the header row that the data under it fills, so captions and chart axis labels no longer win. A row of short codes counts as a header when figures fill at least half of the cells below it.
  • Cells drawn as one string, with wide word or character spacing between them, are split for table detection at blank stretches of 2 em or more. Text, LayoutText and Search read the string as drawn.
  • Kerned pieces join into words before columns are found (#50), so a heading drawn as R + eceiv + ed is one heading.

Text with its layout

Text() puts at most 10 spaces between spans, so columns drift from line to line, and a cell set a few points off its row's baseline becomes a line of its own. LayoutText starts each run of text at the column its x gives and joins lines within half an em into one row (#54):

text, err := doc.LayoutText()        // the whole document
text, err = doc.Page(0).LayoutText() // one page
lines := pdf.LayoutLines(spans)      // spans you already have

Text() is unchanged.

Fixes that change existing behaviour

  • FindTable(spans, nil) and Tables()[0] return the first table found on the page. On a page with a details block above the item table, that is now the details block. Before, the two often came back as one table.
  • Row labels get a column. When at least half of the rows of a FindTableAcrossPages table start with text left of the first heading, that text gets a column of its own with no name. The columns after it move one place to the right.
  • A header with no data under it on its page is no longer taken, such as a header at the foot of a page whose rows all start on the next one.
  • AutoTune skips a merge setting that leaves more cells holding two figures than the unmerged table has.
  • Words break at small gaps the pen moved across (#55). A span the producer placed more than 0.10 em away starts a new word, so "12 EA" no longer reads "12EA". Letter-spaced text stays one word.
  • Type3 widths are scaled by the font matrix (#52). Fonts with an identity matrix no longer put up to 10 spaces between every word.
  • A negative font size reads as its height (#53). TextSpan.FontSize is positive on pages flipped with a negative Tf.
  • Outlined pages space words, not letters (#51).

Other fixes

  • An empty stream reads as empty content (#49). A page whose /Contents holds an empty FlateDecode stream next to the real one can be read.
  • A /Length outside the file falls back to the endstream search instead of panicking (#56).

Page.Tables() takes 7.2 ms per ICDAR document against 5.6 before #59, extraction included, and text extraction alone takes about 8% longer. No exported library symbols were removed.

Full changelog: v0.12.0...v0.13.0

Don't miss a new gopdf release

NewReleases is sending notifications on new releases.