James R. Barlow
40afcd68a7
pluginspec: spacing
2023-10-24 00:54:31 -07:00
James R. Barlow
f238e721ed
Improve documentation of new public hOCR APIs
2023-10-24 00:54:31 -07:00
James R. Barlow
16eb5627a7
Fix unused imports and other trivia
2023-10-24 00:54:31 -07:00
James R. Barlow
fbf0674189
hocr_to_ocr_pdf: handle missing hocr json file
2023-10-24 00:54:31 -07:00
James R. Barlow
62c4f65fc3
Remove duplicate thread local storage of page numbers
2023-10-24 00:54:31 -07:00
James R. Barlow
e400112f32
Improve ._pipelines naming
2023-10-24 00:54:31 -07:00
James R. Barlow
7935914f55
Use empty .hocr file instead of dummy template for symmetry with sandwich
2023-10-24 00:54:31 -07:00
James R. Barlow
b9646b6f85
Enable multiprocessing freeze_support (for Windows) and enable forkserver
...
Since we use a thread for logging among other possibilities, we were
never able to use threads safely when forking. forkserver will do the job.
2023-10-24 00:54:30 -07:00
James R. Barlow
53c953a561
Fix use_threads logic for get_pdfinfo
...
Some debug code was level in place that forced pdfinfo to run with only
one worker when --use-threads was issued. That is how it ought to be,
since threaded pdfinfo workers just fight over the GIL and there is no
sense in parallelizing them.
Also, the user's --use-threads or --no-use-threads would be ignored in
the case of pdfinfo. By setting max_workers=1 we disabled worker processes.
This fixes how that decision is made (putting it in the relevant code, which
knows its constraints) and allows the user to influence the
thread/process decision again.
2023-10-24 00:54:30 -07:00
James R. Barlow
c278fecb34
Rename post_process -> postprocess
...
For consistency with preprocess
2023-10-24 00:54:30 -07:00
James R. Barlow
23951c9e38
Working HOCR folder to PDF converter
2023-10-24 00:54:30 -07:00
James R. Barlow
e8ae370ceb
Eliminate api= kwarg and implicit creation of pluginmanager
2023-10-24 00:54:30 -07:00
James R. Barlow
67be4d1904
Refactor CLI exception handling
2023-10-24 00:54:30 -07:00
James R. Barlow
6f82097d14
Refactor setup_pipeline to decouple manage_work_folder
2023-10-24 00:54:30 -07:00
James R. Barlow
fc6f959d21
Refactor debug log and work folder context cleanup
2023-10-24 00:54:30 -07:00
James R. Barlow
e38d569d8f
languages: kwargs are overkill
2023-10-24 00:54:30 -07:00
James R. Barlow
0856750ee2
Fix exit code error on Ghostscript failure
2023-10-24 00:54:30 -07:00
James R. Barlow
05721ba84a
Fix error on no languages available
2023-10-24 00:54:30 -07:00
James R. Barlow
38c3422e5e
Automatically set document language to OCR language
2023-10-24 00:54:30 -07:00
James R. Barlow
d153a6f6df
Refactor metadata handling
2023-10-24 00:54:30 -07:00
James R. Barlow
1a7738a925
Refactor -migrate metadata repair to new module
2023-10-24 00:54:30 -07:00
James R. Barlow
8985c0dfe9
Refactor setup_pipeline to context manager
2023-10-24 00:52:31 -07:00
James R. Barlow
ebfe008432
Refactor logging record thread local storage
2023-10-24 00:52:31 -07:00
James R. Barlow
1f16eb6f50
Refactor main pipeline into discrete pipelines
...
- test_ghostscript_pdfa_failure fails
- haven't dealt with logging record factories
Further refactoring and duplicate elimination
2023-10-24 00:52:31 -07:00
James R. Barlow
cbb0868ae3
Add hocr to ocr pdf pipeline
2023-10-24 00:52:31 -07:00
James R. Barlow
68bb38d0ad
pdf_to_hocr: improve plugin handling
2023-10-24 00:52:31 -07:00
James R. Barlow
0443e87345
Introduce pdf_to_hocr API
2023-10-24 00:52:31 -07:00
James R. Barlow
b3de5833d3
Refactor conversion of ocrmypdf.ocr() arguments to cmdline
2023-10-24 00:52:31 -07:00
James R. Barlow
95b14ee282
Refactor lossless reconstruction setter into separate function
...
Still messy but good enough as a start.
2023-10-24 00:52:31 -07:00
James R. Barlow
07b89e6a19
Plugin manager: set reasonable default when called without params
2023-10-24 00:52:31 -07:00
James R. Barlow
8991d2cb33
Refactor main pipeline and start hocr pipeline
2023-10-24 00:52:31 -07:00
James R. Barlow
86a20c4130
Refactor exec_page_sync to outputs
2023-10-24 00:52:31 -07:00
James R. Barlow
6827a6efe8
Refactor exec_page_sync -> extract _process_page
2023-10-24 00:52:31 -07:00
James R. Barlow
93fda0dd00
Detect and warn about Tagged PDFs
2023-10-12 01:03:09 -07:00
James R. Barlow
d4110e78cb
Fix "pikepdf mmap disabled" spam on macOS
2023-10-11 01:24:29 -07:00
James R. Barlow
5285d68fcc
Add check for filenotfound due to being inside a snap
2023-10-11 01:02:50 -07:00
James R. Barlow
9346d1f970
Simplify deep nested with-block
2023-10-09 02:30:30 -07:00
James R. Barlow
0687568e1b
sync: update documentation
2023-10-04 00:05:27 -07:00
James R. Barlow
3086cfc3d9
pipeline: documentation and tweak merge_sidecars
2023-10-04 00:05:19 -07:00
James R. Barlow
91a14660b3
Require Pillow >= 10.0.1 and drop shims for older versions
2023-10-04 00:04:28 -07:00
James R. Barlow
539f0ee0ce
Document some missing CLI options to API
2023-10-03 23:54:24 -07:00
James R. Barlow
7172817cd6
Replace ExitStack with contextmanager
2023-10-02 16:52:06 -07:00
James R. Barlow
364799fc3e
Fix typing for pdinfo.layout and modernize
...
Also changed handling of undefined chars to be more Liskov-consistent with parent class.
2023-10-01 01:18:22 -07:00
James R. Barlow
f4c211fa2d
Use Python 3.9-style type hinting for tuple[] and AbstractSet -> Set
2023-10-01 00:09:05 -07:00
James R. Barlow
113a6b45bd
ruff autofixes (mostly typing.* -> collections.abc.*)
2023-10-01 00:02:53 -07:00
James R. Barlow
e9419d2c40
Update notes on concurrency
2023-09-30 17:05:58 -07:00
James R. Barlow
c8e6f20f8d
Change 32-bit message from error to warning
2023-09-26 20:03:06 -07:00
James R. Barlow
d5128c5cf5
Further improvements to image DPI calculation
2023-09-26 00:28:54 -07:00
James R. Barlow
270e31fa67
Fix pluginmanager typing
2023-09-25 14:42:48 -07:00
James R. Barlow
85e31d0a19
Tidy imports and line length
2023-09-25 01:04:01 -07:00