From 73d44c21c2f4c359953afb893763873e35fd2687 Mon Sep 17 00:00:00 2001 From: Jeremy Singer-Vine Date: Sat, 5 Mar 2016 19:03:21 -0500 Subject: [PATCH] Fix doctop-on-crop calculation --- pdfplumber/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdfplumber/utils.py b/pdfplumber/utils.py index 08ddc4f..6c4d8b4 100644 --- a/pdfplumber/utils.py +++ b/pdfplumber/utils.py @@ -93,7 +93,7 @@ def crop_obj(obj, bbox, score=None): score = obj_inside_bbox_score(obj, bbox) if score == 0: return None if score == 4: return obj - x0, top, x1, bottom = bbox + x0, top, x1, bottom = map(float, bbox) copy = dict(obj) x_changed = False @@ -107,7 +107,7 @@ def crop_obj(obj, bbox, score=None): if copy["top"] < top: diff = top - copy["top"] copy["top"] = top - copy["doctop"] = copy["doctop"] - diff + copy["doctop"] = copy["doctop"] + diff copy["y1"] = copy["y1"] - diff y_changed = True if copy["bottom"] > bottom: