James R. Barlow
c725bf79da
flake8 delinting
2021-09-21 16:37:03 -07:00
James R. Barlow
79fd8d01a5
info: fix incorrect handling of inline images and other typing fixes
2021-09-15 00:26:15 -07:00
James R. Barlow
95d9e8d91a
info: inconsistent types used in ContentsInfo.name_index
...
This broke PyPy but CPython is fine with it.
2021-08-28 00:18:14 -07:00
James R. Barlow
3764ee872a
typing: refactor namedtuples in info
2021-08-27 00:51:11 -07:00
James R. Barlow
9b81e76ed4
typing: fix issues; avoid some magic literals
2021-08-26 23:48:27 -07:00
James R. Barlow
4eca0a165b
pre-commit: pyupgrade modernizing
2021-08-26 18:04:38 -07:00
James R. Barlow
5112e9e857
Redo dpi calc to avoid 'math.ulp'
2021-04-16 00:54:41 -07:00
James R. Barlow
d673126994
Fix ZeroDivisionError on files containing images drawn at scale 0
...
Fixes #761
2021-04-15 23:26:14 -07:00
James R. Barlow
a4e1f8e1f3
Merge branch 'feature/lambda'
2021-04-01 16:36:22 -07:00
James R. Barlow
d274d88929
Refactor to eliminate global state in _concurrent
2021-01-30 17:36:30 -08:00
James R. Barlow
ef1e7a814e
Delinting
2021-01-26 01:45:04 -08:00
James R. Barlow
6953f32465
pdfinfo: remove some messy concurrency handling
...
We can cut down on the use of global variables and save opening
an extra copy of the Pdf when threaded.
2021-01-24 23:46:33 -08:00
James R. Barlow
26b4d9bb4b
Refactor concurrency so that it is pluggable
...
However, this may not be the best idea because it involves global
state that could be overridden by a parallel call to ocrmypdf.ocr.
2021-01-24 23:46:29 -08:00
James R. Barlow
0b3a526049
Partial fix crash on 'userunit' None ( #700 )
...
Our method of getting data from pdfminer would silently consume a StopIteration
if pdfminer returned no processed pages, leading to odd error message.
We improve an error from pdfminer properly, and returning a more
descriptive error of our own.
It would be possible for ocrmypdf to repair the file before sending it to
pdfminer, but this seems to be rare enough that we won't do that yet.
2021-01-01 01:11:32 -08:00
James R. Barlow
416df803d4
pdfinfo: stricter typing
2020-12-24 22:39:00 -08:00
James R. Barlow
037b96ca16
pdfinfo: refactor to eliminate RawPageInfo
2020-12-24 02:57:44 -08:00
James R. Barlow
bb258fc99c
pdfinfo: Refactor pageinfo dictionary into a class
2020-12-24 01:47:53 -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
3707af3b74
Change pdf.root to pdf.Root
2020-11-03 01:30:31 -08: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
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
d6128e6937
Fix support for older versions of pdfminer.six (boxes_flow error)
2020-07-26 21:51:25 -07:00
James R. Barlow
642437e804
Merge branch 'master' of github.com:jbarlow83/OCRmyPDF
2020-07-22 00:34:33 -07:00
James R. Barlow
a672422b0b
Enable pikepdf mmap in other contexts
2020-07-22 00:20:07 -07:00
fcatus and GitHub
d80d963cea
pdfinfo: Replace list comp with gen expr'n
2020-07-20 02:21:58 -07:00
James R. Barlow
dc42beb6a8
More typing improvements
...
Typing fixes bugs.
2020-06-30 15:02:30 -07:00
James R. Barlow
378f543619
TextPositionTracker: set boxes_flow=None
...
We don't care about the order of lines in our analysis, and this is an
expensive calculation in pdfminer.
2020-06-30 04:20:58 -07:00
James R. Barlow
c9bd87254e
A few minor typing issues
2020-06-22 02:31:53 -07:00
James R. Barlow
7caf1e85ff
info: change "Scan" message
2020-06-10 12:11:37 -07:00
James R. Barlow
f59a757e8b
info: tidy handling of content streams
2020-06-10 12:09:24 -07:00
James R. Barlow
872bafad4b
Reinstate quick test for text/no text
...
Partial revert of commit 991db17
2020-06-10 12:00:52 -07:00
James R. Barlow
8599400445
Only do page analysis on pages we will do OCR on
2020-06-10 11:33:27 -07:00
James R. Barlow
b6eebadf05
Use pikepdf.open with block to manage PdfInfo
2020-06-10 11:32:46 -07:00
James R. Barlow
fe156db41d
Merge branch 'release/v10' into trialmerge
2020-06-09 15:12:56 -07:00
James R. Barlow
d118132fa6
layout: look for text in XObjects too
2020-06-03 13:16:55 -07:00
James R. Barlow
a2d3e0b53e
Convert remaining imports to absolute
2020-05-12 02:12:08 -07:00
James R. Barlow
977665d2b6
Delint some tests
2020-05-08 03:49:33 -07:00
James R. Barlow
85cbf94a6e
Convert many uses of str paths to Path
2020-05-06 02:53:47 -07:00
James R. Barlow
c85278b31d
Delinting
2020-05-03 00:53:29 -07:00
James R. Barlow
18c4aa10bf
Adjust number of workers for concurrent page scanning
2020-04-26 04:21:15 -07:00
James R. Barlow
991db17fde
Remove Ghostscript-based text extraction
...
While faster than Python based methods, we've outgrown the limited
amount of information Ghostscript provides with this feature, and it
repeats an analysis we have to do anyway to learn what images are
present.
2020-04-26 04:02:07 -07:00
James R. Barlow
27a3b80376
Use once-per-worker pikepdf init
2020-04-26 03:49:20 -07:00
James R. Barlow
8c381a0227
Replace task_initargs with use of partial()
2020-04-26 03:49:20 -07:00
James R. Barlow
86145a8c76
Some wrong with forking worker_pdf, just open it once per page for now
2020-04-26 03:49:20 -07:00
James R. Barlow
7513f5425c
Fix some broken tests
2020-04-26 03:49:20 -07:00
James R. Barlow
af3c3c6466
Further refactoring of concurrency concerns
2020-04-26 03:49:20 -07:00
James R. Barlow
db3e75e33e
Refactor multiprocessing pool
2020-04-26 03:49:13 -07:00
James R. Barlow
ce49fc26dd
Do pikepdf.open() once instead of per worker
2020-04-26 03:42:13 -07:00
James R. Barlow
d0d0a98dca
First cut at concurrent page scan
...
Improvement appears on 168 page file. Needs refactoring
2020-04-26 03:42:13 -07:00
James R. Barlow
94c52a6fa3
Refactor 'xyres' into Resolution
2020-04-24 04:12:05 -07:00