diff --git a/camelot/lattice.py b/camelot/lattice.py index 52501e2..f9a86e3 100644 --- a/camelot/lattice.py +++ b/camelot/lattice.py @@ -222,7 +222,8 @@ class Lattice: gs_call.insert(0, "gs") else: gs_call.insert(0, "gsc") - subprocess.call(gs_call) + subprocess.call(gs_call, stdout=open(os.devnull, 'w'), + stderr=subprocess.STDOUT) img, threshold = adaptive_threshold(imagename, invert=self.invert) pdf_x = width diff --git a/camelot/pdf.py b/camelot/pdf.py index 5318626..11cc6b4 100644 --- a/camelot/pdf.py +++ b/camelot/pdf.py @@ -89,8 +89,7 @@ class Pdf: outfile.addPage(page) with open(sp_path, 'wb') as f: outfile.write(f) - layout, dim = get_page_layout(sp_path, char_margin=1.0, - line_margin=0.5, word_margin=0.1) + layout, dim = get_page_layout(sp_path) lttextlh = get_text_objects(layout, ltype="lh") lttextlv = get_text_objects(layout, ltype="lv") ltchar = get_text_objects(layout, ltype="char") diff --git a/camelot/utils.py b/camelot/utils.py index 1f8e5e6..5134579 100644 --- a/camelot/utils.py +++ b/camelot/utils.py @@ -671,7 +671,7 @@ def get_text_objects(layout, ltype="char", t=None): return t -def get_page_layout(pname, char_margin=2.0, line_margin=0.5, word_margin=0.1, +def get_page_layout(pname, char_margin=1.0, line_margin=0.5, word_margin=0.1, detect_vertical=True, all_texts=True): """Returns a PDFMiner LTPage object and page dimension of a single page pdf. See https://euske.github.io/pdfminer/ to get definitions