Documentation
¶
Overview ¶
Package layout groups positioned characters into words, lines and text boxes, and orders the boxes for reading. It is a port of pdfminer.six's layout analysis (layout.py), so text comes out in the order and with the spacing pdfminer (and so markitdown) gives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultParams = Params{LineOverlap: 0.5, CharMargin: 2.0, LineMargin: 0.5, WordMargin: 0.1, BoxesFlow: 0.5}
DefaultParams are pdfminer.six's defaults.
Functions ¶
Types ¶
type Char ¶
type Char struct {
Rect
Text string
Font string
Size float64 // height for horizontal text, width for vertical
Adv float64
Upright bool
Vertical bool
}
Char is one drawn character.
type Figure ¶
Figure is the content of a form XObject. Like pdfminer, the analysis leaves its characters as drawn.
type Item ¶
type Item interface{ Box() Rect }
Item is something on a page: a *Char or a *Figure before analysis; after it, also *TextBox and *TextLine.
type Page ¶
type Page struct {
Rect
Number int
Items []Item // as drawn; after Analyze, boxes then other items
}
Page is one page's content.
type Params ¶
type Params struct {
LineOverlap float64
CharMargin float64
LineMargin float64
WordMargin float64
BoxesFlow float64
NoBoxesFlow bool // order boxes by position alone (boxes_flow=None)
DetectVertical bool
}
Params tunes the analysis; DefaultParams are pdfminer's LAParams.
type Path ¶
Path is a painted path: a line, rectangle or curve, with the points pdfminer keeps for it (each segment's end point). Layout analysis leaves paths alone; table detection reads their edges.
type Rect ¶
type Rect struct{ X0, Y0, X1, Y1 float64 }
Rect is a bounding box in PDF user space: x grows right, y grows up.
type TextBox ¶
type TextBox struct {
Rect
Vertical bool
Lines []*TextLine
// contains filtered or unexported fields
}
TextBox is a block of lines, such as a paragraph.