4fad0d1f by 周伟奇

add latigation

1 parent ce86bdd5
......@@ -13,6 +13,9 @@ class OCR2Exception(Exception):
class OCR4Exception(Exception):
pass
class LTGTException(Exception):
pass
class GCAPException(Exception):
pass
......
......@@ -702,6 +702,23 @@ class BSWorkbook(Workbook):
if field_str is not None:
count_list.append((field_str, count))
def ltgt_build(self, label, result_dict):
ws = self.create_sheet(label)
for key, value in result_dict.items():
if isinstance(value, list):
ws.append((key, *value))
elif isinstance(value, dict):
if 'words' in value:
ws.append((key, value['words']))
else:
for sub_key, sub_value in value.items():
if isinstance(sub_value, dict):
ws.append(('{0}: {1}'.format(key, sub_key), sub_value.get('words', '')))
else:
ws.append(('{0}: {1}'.format(key, sub_key), sub_value))
else:
ws.append((key, value))
def simple_license_rebuild(self, license_summary, document_scheme):
# for ic_license_dict in license_summary.get(consts.IC_CLASSIFY, []):
# if ic_license_dict.get('类别') == '1':
......
......@@ -225,3 +225,13 @@ class PDFHandler:
else:
self.merge_il(pdf, pno, il)
self.img_count = len(self.img_path_list)
def extract_page_image(self):
self.img_path_list = []
self.xref_set = set()
os.makedirs(self.img_dir_path, exist_ok=True)
with fitz.Document(self.path) as pdf:
for pno in range(pdf.pageCount):
page = pdf.loadPage(pno)
self.page_to_png(page)
self.img_count = len(self.img_path_list)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!