James R. Barlow
78b71618c1
Fix BufferedReader TypeError
2020-12-11 14:19:20 -08:00
James R. Barlow
b8aa89e1ec
Fix log message queue flooding on certain files
...
Fixes #692
2020-12-11 14:14:21 -08:00
James R. Barlow
b4c1f66bc1
typing: tidy up
2020-12-11 14:14:21 -08:00
James R. Barlow
5172dbde8d
subprocess: use more mypy-friendly syntax
2020-12-11 14:14:21 -08:00
James R. Barlow
d2908640c6
pdfa: help mypy figure out a type
2020-12-11 14:14:21 -08:00
James R. Barlow
997bf7578d
hocrtransform: fix exception if no div ocr_page object
2020-12-11 14:14:21 -08:00
James R. Barlow
043258242c
hocrtransform: trivial typing
2020-12-11 14:14:21 -08:00
James R. Barlow
156d5d9a9c
cli: typing
2020-12-11 14:14:21 -08:00
James R. Barlow
0b7e52fb5e
api: parse cmdline in more type friendly way
2020-12-11 14:14:21 -08:00
James R. Barlow
a5feef07d0
Declare ocrmypdf as typed
2020-12-11 14:14:21 -08:00
James R. Barlow
f11bb53e61
Change prefix of temporary folders
...
Shouldn't really use a name that suggests a connection to GitHub.
2020-12-07 21:51:46 -08:00
James R. Barlow
68a57a7839
Add feature to generate hocr-pdf with visible debug text
2020-12-04 17:38:48 -08:00
James R. Barlow
3cba50bfbd
windows: look in registry for Tesseract and Ghostscript
2020-12-04 13:21:54 -08:00
James R. Barlow
ce0e0ecd4d
Decouple tqdm from progressbar setup
2020-12-04 13:20:28 -08:00
James R. Barlow
7e1223c12c
ghostscript: add output tracing
2020-11-29 14:53:35 -08:00
James R. Barlow
b83d7f6d1a
subprocess: refactor and add run_polling_stderr
2020-11-29 14:36:03 -08:00
James R. Barlow
80e957908a
tesseract: fix run call with logs_errors_to_stdout
2020-11-29 14:25:46 -08:00
James R. Barlow
43f41863fa
check_pdf: document how we handle linearization
2020-11-18 11:54:07 -08:00
James R. Barlow
d71e50e83d
Fix "readLinearizationData for file that is not linearized"
...
pikepdf 2.1.0 throws wrong type of exception in this case, so special-case it.
Closes #680
Closes #681
2020-11-18 11:52:17 -08:00
James R. Barlow
1f598da3c1
ghostscript: better docs and comments
2020-11-18 11:34:17 -08:00
James R. Barlow
5c56f61209
unpaper: type hints
2020-11-11 02:59:37 -08:00
James R. Barlow
895fddd85e
Replace most uses of universal_newlines with text
...
The parameters are equivalent but the latter is better named. Since
Python 3.6 doesn't support text= we use our wrapper to add it in that
place.
This is for subprocess.run.
2020-11-07 00:48:08 -08:00
James R. Barlow
5a59e4d543
unpaper: don't use universal_newlines=True
...
There's no specific reason to do this. We can log binary output equally
well.
2020-11-07 00:18:27 -08:00
James R. Barlow
6d3f9ff15a
api: rework ocr() slightly to simplify variable handling
2020-11-03 17:10:52 -08:00
James R. Barlow
b913e5dfef
ghostscript: don't repeat log in debug
...
Subprocess already does this for us.
2020-11-03 01:45:06 -08:00
James R. Barlow
dd8a5a4c72
Fix log domain names
...
ocrmypdf.subprocess.subprocess.ghostscript -> ocrmypdf.subprocess.ghostscript
2020-11-03 01:44:35 -08:00
James R. Barlow
36e9a54f02
Remove extraneous page rotation
...
This was added in commit b5ccbfd but seems to have been ill-advised.
2020-11-03 01:34:28 -08:00
James R. Barlow
3707af3b74
Change pdf.root to pdf.Root
2020-11-03 01:30:31 -08:00
James R. Barlow
ced7ad9164
unpaper: round off DPI
2020-11-03 01:14:57 -08:00
James R. Barlow
54bbbfdeb3
Fix UnboundLocalError when considering ImageMasks for optimization
...
Uncovered by test file in issue 667, although unrelated to that issue.
2020-11-03 01:08:14 -08:00
James R. Barlow
19bf3aeb00
api: improve typing
2020-11-02 02:33:34 -08:00
James R. Barlow
e86be0031c
unpaper: fix process output handling
...
With the ocrmypdf.subprocess wrapper, logging the output here
is redundant and loses the page number context.
2020-11-02 01:07:41 -08:00
James R. Barlow
6425977998
unpaper: use pnm instead of png
...
Some users reported problems with PNG recently; try PNM.
Fixes #665
Fixes #667
2020-11-02 01:05:56 -08:00
James R. Barlow
d57df2d980
subprocess: support programs that write their messages to stdout
2020-11-02 01:00:59 -08:00
James R. Barlow
664d0c7969
Document configure_debug_logging
2020-11-02 00:59:00 -08:00
James R. Barlow
a354663ee1
Fix typo in API documentation
2020-11-02 00:58:28 -08:00
James R. Barlow
d55e673d9c
Fix warning about --pdfa-image-compression argument at wrong times
...
Closes #663
2020-10-27 23:09:45 -07:00
Edward Betts and GitHub
2def7e3392
Use % for percentage in string format ( #643 )
2020-10-27 23:09:14 -07:00
James R. Barlow
5ba56adb53
Fix page rotation issue (again)
...
Commit 1327ab3 introduced a fix for a regression, which was reported
in #581 , #634 . It appears that the actual cause of this issue was
default parameters to rasterize_pdf_page in pluggy not working as
expected, causing a default rotation=0 even when a rotation was needed.
As such the OCR image was generated with the wrong orientation,
causing the initial regression and fix in commit 1327ab3 .
Now that the real problem is identified, it's apparent that the logic
prior to 1327ab3 was found and we can revert to 1327ab3 since it fixes
all known cases including #658 .
This reverts 1327ab3 except for retaining improves to rotation output.
2020-10-24 02:45:21 -07:00
James R. Barlow
b5ccbfdf25
Fix hookspec of rasterize_pdf_page to remove default parameters
2020-10-24 02:35:18 -07:00
James R. Barlow
8c35d6e6e4
Fix debug log messages being suppressed from child processes
2020-10-22 02:20:06 -07:00
James R. Barlow
d1e0c81eda
Ensure worker_pdf is closed after gathering info in a thread
...
This is hacky, uses global state, but it does improve the situation for now.
2020-10-22 00:38:24 -07:00
James R. Barlow
10c8e4f8b4
Only create debug.log when running from command line
...
When used as a library ocrmypdf shouldn't make policy decisions, like where to
put a log file. Unsurprisingly, creating it causes problems for library users
because we deleted the temporary folder which held the log file and made no
effort to move it to a new location.
Also update the documentation to better described how an application should
handle this.
Closes #657
2020-10-20 01:29:36 -07:00
James R. Barlow
6be2242c21
Describe "OCR" step as "Image processing" when --tesseract-timeout=0
...
Fixes #647
2020-10-08 01:03:42 -07:00
James R. Barlow
204c9d6ae1
Fix inverted colors during JBIG2 optimization on paletted images
...
Fixes #640
2020-10-07 04:08:50 -07:00
James R. Barlow
4e15eb8d14
Fix image optimization discarding image masks and soft masks associated with PNGs
...
Fixes #648
2020-10-06 03:20:54 -07:00
James R. Barlow
8b01ab8ad2
Better type checking on ocrmypdf.ocr(plugins=...)
2020-10-05 15:02:34 -07:00
James R. Barlow
4eacb3454f
hOCR: write text in correct order
...
Fixes #642
2020-09-29 02:45:11 -07:00
James R. Barlow
3ef8872a1e
pngquant driver: refactor, use streams instead of temporary files
2020-09-25 00:18:02 -07:00
James R. Barlow
28eec73eed
Tighten unpaper-args validation to exclude . and ..
...
Just in case
2020-09-25 00:18:02 -07:00