Merge pull request #56 from jbarlow83/for-upstream/hocr-selfwidth

Fix AttributeError on self.width if Tesseract finds no OCR text
This commit is contained in:
fritz-hh
2014-01-13 08:44:16 -08:00
+1
View File
@@ -115,6 +115,7 @@ class hocrTransform():
self.xmlns = matches.group(1)
# get dimension in pt (not pixel!!!!) of the OCRed image
self.width, self.height = None, None
for div in self.hocr.findall(".//%sdiv[@class='ocr_page']"%(self.xmlns)):
coords = self.element_coordinates(div)
self.width = self.px2pt(coords[2]-coords[0])