diff --git a/pdfplumber/table.py b/pdfplumber/table.py index 9101636f..a6e3fcb5 100644 --- a/pdfplumber/table.py +++ b/pdfplumber/table.py @@ -486,8 +486,8 @@ def get_edges(self): else: v_explicit.append( { - "x0": desc, - "x1": desc, + "x0": utils.decimalize(desc), + "x1": utils.decimalize(desc), "top": self.page.bbox[1], "bottom": self.page.bbox[3], "height": self.page.bbox[3] - self.page.bbox[1], @@ -520,8 +520,8 @@ def get_edges(self): "x0": self.page.bbox[0], "x1": self.page.bbox[2], "width": self.page.bbox[2] - self.page.bbox[0], - "top": desc, - "bottom": desc, + "top": utils.decimalize(desc), + "bottom": utils.decimalize(desc), "orientation": "h", } ) diff --git a/tests/test_table.py b/tests/test_table.py index 114582c9..ebca754e 100644 --- a/tests/test_table.py +++ b/tests/test_table.py @@ -60,6 +60,18 @@ def test_edges_strict(self): "" ] + def test_explicit_desc_decimalization(self): + """ + See issue #290 + """ + tf = table.TableFinder(self.pdf.pages[0], { + "vertical_strategy": "explicit", + "explicit_vertical_lines": [ 100, 200, 300 ], + "horizontal_strategy": "explicit", + "explicit_horizontal_lines": [ 100, 200, 300 ], + }) + assert tf.tables[0].extract() + def test_text_without_words(self): assert table.words_to_edges_h([]) == [] assert table.words_to_edges_v([]) == []