The table_settings dictionary allows you to customize how pdfplumber identifies table borders and cells.
Strategies
Both vertical_strategy and horizontal_strategy accept:
"lines": Uses graphical lines and rectangle edges."lines_strict": Uses graphical lines but ignores rectangle edges."text": Deduces lines based on word alignment (left, right, center, or top)."explicit": Uses only the lines provided in explicit_vertical_lines or explicit_horizontal_lines.
Key Configuration Keys
| Key | Description |
|---|
vertical_strategy | Strategy for vertical cell separators. |
horizontal_strategy | Strategy for horizontal cell separators. |
explicit_vertical_lines | List of x-coordinates or line/rect/curve objects to use as vertical separators. |
explicit_horizontal_lines | List of y-coordinates or line/rect/curve objects to use as horizontal separators. |
snap_tolerance | Tolerance for snapping parallel lines together. |
join_tolerance | Tolerance for joining line segments on the same infinite line. |
edge_min_length | Minimum length for an edge to be considered. |
text_* | Settings passed to Page.extract_text() for text extraction within cells. |
Note: It is often helpful to use Page.crop(bounding_box) to isolate a specific area of a page before calling table extraction methods.
{
"vertical_strategy": "lines",
"horizontal_strategy": "lines",
"explicit_vertical_lines": [],
"explicit_horizontal_lines": [],
"snap_tolerance": 3,
"snap_x_tolerance": 3,
"snap_y_tolerance": 3,
"join_tolerance": 3,
"join_x_tolerance": 3,
"join_y_tolerance": 3,
"edge_min_length": 3,
"edge_min_length_prefilter": 1,
"min_words_vertical": 3,
"min_words_horizontal": 1,
"intersection_tolerance": 3,
"intersection_x_tolerance": 3,
"intersection_y_tolerance": 3,
"text_tolerance": 3,
"text_x_tolerance": 3,
"text_y_tolerance": 3,
}