#1360·pdfplumber

Table header lines not detected correctly with line-based strategies in pdfplumber

Author: kleven11Created Feb 17, 2026Updated Feb 18, 2026
Labelsbug

Describe the bug

When I try to run the below code, for some reason in the header area and above that, the debug_tablefinder does not give straight lines with respect to the columns vertical lines.

Code to reproduce the problem

import pdfplumber
table_settings = {
    "vertical_strategy": "lines", 
    "horizontal_strategy": "lines",
    "intersection_tolerance": 5,
    "snap_tolerance": 3,
    "join_tolerance": 3,
    "edge_min_length": 3,
    "min_words_vertical": 1,
    "min_words_horizontal": 1
}
PDF_PATH = "/home/Desktop/page_issue.pdf"
with pdfplumber.open(PDF_PATH, repair = True) as pdf:
    page = pdf.pages[0]
    im = page.to_image(resolution=150)
    im.debug_tablefinder(table_settings)
    im.show()

PDF file

page_2_no_text_fitz.pdf

Expected behavior

Image

Straight lines across the headers as well. I got this image by specifying the snap_x_tolerance to 8.

Actual behavior

Image

Environment

  • pdfplumber Version: 0.11.9
  • Python version: [e.g., 3.12.3]
  • OS: Linux

Additional context

  • Now when I mention snap_tolerance to >7 and run the same pdf, the issue is resolved, but keeping that high of a snap tolerance is not possible for my use case. Hence, I am looking for solutions other than that.