table

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package table finds ruled tables on a PDF page: tables whose cells are drawn with lines or rectangles. It is a port of pdfplumber's TableFinder with its default settings (the "lines" strategy for both axes), after Anssi Nurminen's thesis and Tabula: edges from the page's lines, rectangles and curves are snapped and joined, their intersections give cells, and cells sharing corners form tables.

It deliberately does not port pdfplumber's "text" strategy, which guesses columns from word alignment: a table only comes from lines actually drawn on the page.

Coordinates here are pdfplumber's: page-relative, y growing downward.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractText

func ExtractText(chars []Char) string

ExtractText is pdfplumber's extract_text with default settings: chars grouped into words, words into lines, lines joined with newlines.

Types

type BBox

type BBox [4]float64

BBox is x0, top, x1, bottom.

type Char

type Char struct {
	X0, X1, Top, Bottom float64
	Text                string
	Upright             bool
}

Char is a character as table extraction sees it.

type Table

type Table struct {
	BBox BBox
	Rows [][]*string
	// Cells holds each cell's characters, parallel to Rows, for callers
	// that assemble cell text their own way.
	Cells [][][]Char
	// Chars counts the characters in the table's cells; Rotated, those not
	// upright; Overflow, those reaching more than a point past their
	// cell's left or right side, as text running across ruled lines does.
	// They help judge whether a grid reads as a table.
	Chars, Rotated, Overflow int
}

Table is a found table: its box, and its rows of cells. A nil cell is a position no cell covers (part of a merged cell).

func Find

func Find(page *layout.Page) []Table

Find returns a page's ruled tables, in order of their top-left cell. The page must have been extracted with paths recorded, and not yet laid out.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL