rehan953 commited on
Commit
0957e2c
·
verified ·
1 Parent(s): dfc40c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -1380,7 +1380,15 @@ def _patch_ocr_with_textlayer(page_md: str, pdf_path: str, page_num: int) -> str
1380
  needs_checks = "checks" not in result.lower() or "<th>Number</th>" not in result
1381
  needs_dab = "daily account balance" not in result.lower()
1382
  if needs_checks or needs_dab:
1383
- raw_tl = extract_zone_text_pdf(pdf_path, page_num, 0.0, 1.0) or ""
 
 
 
 
 
 
 
 
1384
  jb_extra = _extract_jb_summary_sections(raw_tl, needs_checks, needs_dab)
1385
  if jb_extra:
1386
  result = result.rstrip() + "\n\n" + jb_extra
 
1380
  needs_checks = "checks" not in result.lower() or "<th>Number</th>" not in result
1381
  needs_dab = "daily account balance" not in result.lower()
1382
  if needs_checks or needs_dab:
1383
+ # Use get_text() directly (not clip-based) to preserve multi-column layout order
1384
+ try:
1385
+ import pymupdf as _fitz
1386
+ _doc = _fitz.open(pdf_path)
1387
+ _page = _doc[page_num]
1388
+ raw_tl = _page.get_text()
1389
+ _doc.close()
1390
+ except Exception:
1391
+ raw_tl = ""
1392
  jb_extra = _extract_jb_summary_sections(raw_tl, needs_checks, needs_dab)
1393
  if jb_extra:
1394
  result = result.rstrip() + "\n\n" + jb_extra