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
James R. Barlow
bfe4a5b329
Tidy a log message
2020-09-25 00:17:57 -07:00
Suyash Behera and GitHub
9a6cd95e5f
load zlib before liblept on windows ( #633 )
...
fixes #631
2020-09-17 03:14:42 -07:00
James R. Barlow
d464d3122e
Use img2pdf to create optimized PNG images
...
Fixes #629 , #620
2020-09-17 03:11:26 -07:00
James R. Barlow
1327ab37d4
Fix page rotation regression
...
Fixes #634 , #581
2020-09-17 02:57:00 -07:00
James R. Barlow
67553fc5c6
Display page numbers in log messages when grafting
2020-09-17 01:20:50 -07:00
James R. Barlow
306a903854
Remove unused function log_page_orientations
2020-09-17 01:20:02 -07:00
James R. Barlow
b93cf51c0f
Disable pikepdf mmap
...
Infrequently we can reproduce this error:
terminating with uncaught exception of type std::runtime_error: pybind11_object_dealloc(): Tried to deallocate unregistered instance!
The error is probably related to pybind11 issue #2252 and a bunch of
other related issues. Until that is resolved in pybind11 and pikepdf
we will disable the pikepdf mmap interface.
2020-09-16 23:48:55 -07:00
James R. Barlow
8b5b02e0d8
Expand documentation of filter_page_image
2020-09-14 14:36:17 -07:00
James R. Barlow
31994258fb
metadata fixup: don't try to update original PDF's metadata with docinfo
2020-09-08 02:35:16 -07:00
James R. Barlow
1f15ecbca5
Add "Postprocessing" message as a hint for long Ghostscript runs
2020-09-08 02:34:10 -07:00
James R. Barlow
e6a7b58863
Merge branch 'de-gpl'
2020-08-12 12:20:38 -07:00
James R. Barlow
9b641055e1
Fix KeyError: 'dpi' when using --threshold on image to PDF
...
Fixes #607
2020-08-07 02:21:02 -07:00
James R. Barlow
8c90f7c972
Replace GPLv3-derived PDF/A template with PostScript generator
2020-08-05 01:30:45 -07:00
James R. Barlow
aa0ec40102
Change license of all GPLv3 files to MPL-2.0
...
https://github.com/jbarlow83/OCRmyPDF/issues/600
2020-08-05 00:44:42 -07:00
James R. Barlow
4cc0dc6b4a
Additional size increase reasons
2020-08-03 16:03:29 -07:00