From ce727d955877186f871751c4adf33508f3208753 Mon Sep 17 00:00:00 2001 From: Vinayak Mehta Date: Fri, 22 Mar 2019 02:28:29 +0530 Subject: [PATCH] Fix split text bug --- camelot/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/camelot/utils.py b/camelot/utils.py index 7b22307..48e39af 100644 --- a/camelot/utils.py +++ b/camelot/utils.py @@ -479,6 +479,10 @@ def split_textline(table, textline, direction, flag_size=False, strip_text=''): (obj.x0 + obj.x1) / 2 <= cut[1]): cut_text.append((r, cut[0], obj)) break + else: + # TODO: add test + if cut == x_cuts[-1]: + cut_text.append((r, cut[0] + 1, obj)) elif isinstance(obj, LTAnno): cut_text.append((r, cut[0], obj)) elif direction == 'vertical' and not textline.is_empty(): @@ -496,6 +500,10 @@ def split_textline(table, textline, direction, flag_size=False, strip_text=''): (obj.y0 + obj.y1) / 2 >= cut[1]): cut_text.append((cut[0], c, obj)) break + else: + # TODO: add test + if cut == y_cuts[-1]: + cut_text.append((cut[0] - 1, c, obj)) elif isinstance(obj, LTAnno): cut_text.append((cut[0], c, obj)) except IndexError: