James R. Barlow
5ac2d31d0d
Redo OCR can now handle visible and invisible text, so adjust accordingly
...
Still can't filter out corrupt text
2018-10-28 14:06:25 -07:00
James R. Barlow
fda890ab47
pdfinfo: further layout improvements
...
Rather than grouping visible/invisible in a custom analysis step,
use pdfminer's analysis and iterate.
Make iteration predicate and return more generic.
2018-10-28 14:05:50 -07:00
Stefan Weil and jbarlow83
a873278c2a
Fix some recommendations from LGTM ( #309 )
...
* Fix unreachable code
This fixes an issue reported by LGTM.
Signed-off-by: Stefan Weil <sw@weilnetz.de >
* Remove unused imports
This fixes several recommendations from LGTM.
Signed-off-by: Stefan Weil <sw@weilnetz.de >
2018-10-28 13:59:58 -07:00
James R. Barlow
e6d64be890
pdfinfo: formatting
2018-10-27 23:22:44 -07:00
James R. Barlow
0e4d978d20
pdfinfo: all -> not any
2018-10-27 23:22:28 -07:00
James R. Barlow
b12c2cfedf
Fix handling of Type3 fonts with no ToUnicode mapping
2018-10-27 01:24:48 -07:00
James R. Barlow
58cc70725e
Reorganize around getting bboxes for visible/invisible text
2018-10-26 01:07:02 -07:00
James R. Barlow
339afb02aa
--redo-ocr now works in the presence of printable text
2018-10-25 16:53:47 -07:00
James R. Barlow
7ba0ff5c36
Fix strip invisible text bug: missing BT operator
2018-10-25 16:52:23 -07:00
James R. Barlow
ff41fbf673
Add pdfminer based layout analysis
2018-10-25 12:42:35 -07:00
James R. Barlow
2435cd23ce
Move pdfinfo into a package
2018-10-25 00:37:38 -07:00
James R. Barlow
a063cff720
Rename/expose strip_invisible_text
2018-10-24 21:53:24 -07:00
James R. Barlow
0d396e1ac0
option check: Remove always-True condition
...
Both renderers are now lossless reconstruction-capable. (Have
been since 7.0)
2018-10-22 22:13:59 -07:00
James R. Barlow
eb4938a36f
Fix KeyError 'has_vector'
2018-10-20 01:20:22 -07:00
James R. Barlow
c5ad530bbf
pdfinfo: reminder about 'INLINE IMAGE' sentinel
2018-10-20 01:17:08 -07:00
James R. Barlow
d11c428407
Redo OCR: disallow in cases that will damage the output PDF
2018-10-20 01:14:33 -07:00
James R. Barlow
6182b1f53e
Merge branch 'feature/remove-vectors' into feature/redo-ocr
2018-10-20 01:13:24 -07:00
James R. Barlow
00fc1a12e2
optimize: should remove unreference resources too
2018-10-19 00:03:56 -07:00
James R. Barlow
16af753206
Add functional "redo OCR" feature
...
Needs argument validation and some other changes. Needs testing
with mixed-content PDFs.
Only really works for pure invisible text at the moment.
2018-10-19 00:02:19 -07:00
James R. Barlow
fa48205bb8
Add feature to remove vector graphics objects
2018-10-18 21:46:08 -07:00
James R. Barlow
f7dbf94071
pipeline: if vector graphic objects exist, ensure the DPI is reasonable
2018-10-18 01:23:31 -07:00
James R. Barlow
b18e66e2ca
pdfinfo: learn to detect vector graphic objects
2018-10-18 01:21:51 -07:00
James R. Barlow
7a5504dfa5
pdfinfo: fix terminology (operands, command) -> (operands, operator)
2018-10-18 01:18:30 -07:00
James R. Barlow
68bac1b177
Fix compatibility with pikepdf 0.3.5 API change
2018-10-11 15:51:34 -07:00
James R. Barlow
1495b78330
Remove cruft to support leptonica < 1.72 in test suite
2018-10-11 01:37:32 -07:00
James R. Barlow
c1e18bb825
optimize: Exclude soft masks (SMasks) from optimization
...
Soft masks are only allowed to be of colorspace DeviceGray so we
shouldn't use pngquant on them. For now, avoid this exceptional
case by excluded soft masks from optimization.
2018-10-05 01:23:26 -07:00
James R. Barlow
58282ea0fb
optimize: more refactoring
...
Now properly generalized/specialized where it should be
2018-10-04 13:44:51 -07:00
James R. Barlow
891da7834c
optimize: refactor image extraction
2018-10-04 12:34:22 -07:00
James R. Barlow
5c229d48d5
optimize: Reorganize so JBIG2 can be performed on images reduced to 1bpp
...
Closes #297
2018-10-04 11:53:11 -07:00
James R. Barlow
5b84549716
Change JBIG2 lossy mode to require --jbig2-lossy
2018-10-04 01:20:49 -07:00
James R. Barlow
c74f2ee6e8
Refactor the detailed error messages
2018-10-04 00:10:59 -07:00
James R. Barlow
b32dd9f9d3
Fix lossless JBIG2 when there are multiple JBIG2 images on a single page
2018-10-03 17:40:26 -07:00
James R. Barlow
fb8b161f6c
Fix suppression of tesseract config error messages
2018-10-03 17:39:50 -07:00
James R. Barlow
6f554c6ae8
tesseract: account for behavior changes when params are missing
...
Tesseract 4.0-rc1 now accepts invalid parameters in config and
won't return an error anymore. We prefer to raise an error if this
occurs.
See: https://github.com/tesseract-ocr/tesseract/commit/741ea00d7059d8ff7c55797ffc525a461d7f3ced
2018-10-03 15:11:34 -07:00
James R. Barlow
72156b5653
Degrade more gracefully when --optimize is set but JBIG2 is not present
2018-10-03 14:24:20 -07:00
James R. Barlow
9a8ec4b210
optimize: only enable lossy JBIG2 for -O3
2018-10-03 00:38:58 -07:00
James R. Barlow
75aad4cc79
optimize: Refactor convert_to_jbig2
2018-10-02 23:42:12 -07:00
James R. Barlow
4b27feca98
optimize: Disable JBIG2 lossy mode, use lossless instead
2018-10-01 12:28:54 -07:00
James R. Barlow
45522cd15f
weave: clarify comment about garbage data in ToC
2018-09-27 13:48:35 -07:00
James R. Barlow
677d9a4e76
Remove some unhelpful lambdas
2018-09-27 13:48:12 -07:00
James R. Barlow
efa7ea4fde
Fix log.error where log is None
2018-09-19 23:01:27 -07:00
James R. Barlow
137a6e45f5
ghostscript: fix missing fspath for py3.5
2018-09-19 22:57:20 -07:00
James R. Barlow
cfd4f8a850
Improve error handling for improvements to Ghostscript text extraction
2018-09-19 20:29:18 -07:00
James R. Barlow
ef70e538f7
Improve error message on handling KeyboardInterrupt
...
Closes #301
2018-09-19 01:40:26 -07:00
James R. Barlow
b7b912e56a
Fix test suite and blank pages
2018-09-17 01:12:58 -07:00
James R. Barlow
4615cf2f1e
First cut at improving text extraction speed
2018-09-16 23:34:18 -07:00
James R. Barlow
96ba75eabd
Ghostscript: fix issues in strict ASCII implementation
2018-09-16 15:41:54 -07:00
James R. Barlow
fdfe52c1ad
main: add debug option to force threads
2018-09-15 00:01:45 -07:00
James R. Barlow
932b2e2a29
main: print Ghostscript version too
2018-09-14 23:58:06 -07:00
James R. Barlow
57e489c957
main: Cleanup; support overriding sys.args in run_pipeline
2018-09-14 23:57:35 -07:00