Cosmits
* Remove unnecessary kwargs * Direct ghostscript call output to /dev/null * Change char_margin's default valuepull/2/head
parent
bd1d57a561
commit
70f626373b
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue