Display page numbers in log messages when grafting

This commit is contained in:
James R. Barlow
2020-09-17 01:20:50 -07:00
parent 306a903854
commit 67553fc5c6
2 changed files with 14 additions and 10 deletions

View File

@@ -130,7 +130,7 @@ class OcrGrafter:
text_rotation = autorotate_correction
text_misaligned = (text_rotation - content_rotation) % 360
log.debug(
f"Rotations for page {pageno}: [text, auto, misalign, content] = "
f"Rotations for page: [text, auto, misalign, content] = "
f"{text_rotation}, {autorotate_correction}, "
f"{text_misaligned}, {content_rotation}"
)

View File

@@ -252,15 +252,19 @@ def exec_concurrent(context: PdfContext):
ocrgraft = OcrGrafter(context)
def update_page(result: PageResult, pbar):
sidecars[result.pageno] = result.text
pbar.update()
ocrgraft.graft_page(
pageno=result.pageno,
image=result.pdf_page_from_image,
textpdf=result.ocr,
autorotate_correction=result.orientation_correction,
)
pbar.update()
try:
tls.pageno = result.pageno + 1
sidecars[result.pageno] = result.text
pbar.update()
ocrgraft.graft_page(
pageno=result.pageno,
image=result.pdf_page_from_image,
textpdf=result.ocr,
autorotate_correction=result.orientation_correction,
)
pbar.update()
finally:
tls.pageno = None
exec_progress_pool(
use_threads=context.options.use_threads,