Fix #239
This commit is contained in:
@@ -13,7 +13,8 @@ class BaseParser(object):
|
||||
self.layout_kwargs = layout_kwargs
|
||||
self.layout, self.dimensions = get_page_layout(
|
||||
filename, **layout_kwargs)
|
||||
self.horizontal_text = get_text_objects(self.layout, ltype="lh")
|
||||
self.vertical_text = get_text_objects(self.layout, ltype="lv")
|
||||
self.images = get_text_objects(self.layout, ltype='image')
|
||||
self.horizontal_text = get_text_objects(self.layout, ltype='horizontal_text')
|
||||
self.vertical_text = get_text_objects(self.layout, ltype='vertical_text')
|
||||
self.pdf_width, self.pdf_height = self.dimensions
|
||||
self.rootname, __ = os.path.splitext(self.filename)
|
||||
|
||||
@@ -356,8 +356,12 @@ class Lattice(BaseParser):
|
||||
logger.info('Processing {}'.format(os.path.basename(self.rootname)))
|
||||
|
||||
if not self.horizontal_text:
|
||||
warnings.warn("No tables found on {}".format(
|
||||
os.path.basename(self.rootname)))
|
||||
if self.images:
|
||||
warnings.warn('The page is image-based, Camelot only works with'
|
||||
' text-based PDF pages.'.format(os.path.basename(self.rootname)))
|
||||
else:
|
||||
warnings.warn('No tables found on {}'.format(
|
||||
os.path.basename(self.rootname)))
|
||||
return []
|
||||
|
||||
self._generate_image()
|
||||
|
||||
@@ -395,8 +395,12 @@ class Stream(BaseParser):
|
||||
logger.info('Processing {}'.format(os.path.basename(self.rootname)))
|
||||
|
||||
if not self.horizontal_text:
|
||||
warnings.warn("No tables found on {}".format(
|
||||
os.path.basename(self.rootname)))
|
||||
if self.images:
|
||||
warnings.warn('The page is image-based, Camelot only works with'
|
||||
' text-based PDF pages.'.format(os.path.basename(self.rootname)))
|
||||
else:
|
||||
warnings.warn('No tables found on {}'.format(
|
||||
os.path.basename(self.rootname)))
|
||||
return []
|
||||
|
||||
self._generate_table_bbox()
|
||||
|
||||
Reference in New Issue
Block a user