James R. Barlow
38d60ea89b
optimize: don't put flate on large jpegs unless compression is high
...
Putting flate on very large JPEGs can cause performance problems in PDF viewers, subjectively anyway.
2025-10-29 11:39:20 -07:00
James R. Barlow
b213efb030
Account for new deskew output error message from recent Tesseract
...
Fixes #1576
2025-10-16 09:50:03 +02:00
James R. Barlow
414d80fc16
Deprecate semfree and don't auto activate it
...
Instead the standard executor will fall back to threads.
semfree caused test failures with Py3.14:
https://github.com/ocrmypdf/OCRmyPDF/issues/1558
In retrospect and with emerging Python tech like freethreading, semfree is becoming less necessary. We can use threads for the time being.
A consequence is that performance may be lower on Lambda and Termux when we are using threads and not shelling out work.
2025-09-11 17:13:04 -07:00
James R. Barlow
7e7e2f2e91
Raw value in pdfa XML block uses upper case codes, so account for this
2025-09-08 12:46:26 -07:00
5HT2
a7b0c0df6c
fix(src): Refactor CLI help references to PDF/A compliance levels
...
Please see [RFC8118 4.](https://datatracker.ietf.org/doc/html/rfc8118#section-4 ) for examples regarding the PDF/A compliance naming scheme.
Please see [RFC8118 [ISOPDFA]](https://datatracker.ietf.org/doc/html/rfc8118#ref-ISOPDFA ) for more complete information regarding the PDF/A compliance naming scheme.
2025-08-31 20:37:41 +01:00
5HT2
d735791524
fix(src): Refactor valid_part_conforms for PDF/A compliance levels
2025-08-31 20:32:30 +01:00
Alina Bürge and GitHub
a9a8b39dba
Fix the use of the plugin_manager argument ( #1555 )
2025-08-18 13:00:39 -07:00
James R. Barlow
6af22051a8
Avoid call to deprecated pdf.check() where possible
2025-08-13 01:15:33 -07:00
James R. Barlow
61163c2aa9
Fix stupid Python runtimeerror
2025-06-13 01:46:30 -07:00
James R. Barlow
332369f1b0
Adjust set_start_method decision, changing fork to forkserver for platforms other than win32, darwin
2025-06-13 01:22:01 -07:00
James R. Barlow
3beabf55e7
Skip optimizing images with pre-blended soft masks
...
Fixes issue [Bug]: Optimized pdf not rendering with Quartz / Core Graphics #1536
2025-06-12 23:58:43 -07:00
BBC-Esq and GitHub
0970cebfea
Update _hocr.py
2025-03-08 07:37:37 -05:00
James R. Barlow
c05ed7297c
Merge branch 'main' of github.com:ocrmypdf/OCRmyPDF
2025-02-26 15:16:07 -08:00
Odin Dahlström and James R. Barlow
c29f58a8b7
Process hOCR textangle attribute
2025-02-26 15:09:59 -08:00
jbarlow and GitHub
eb303fef1a
Merge pull request #1441 from aliemjay/fix-prog-bar
2025-02-26 15:05:54 -08:00
James R. Barlow
19af116034
Tidy whitespace
2025-02-06 00:40:35 -08:00
Odin Dahlström
b7d63f3dc1
Process ocr_caption lines
2025-01-30 17:49:06 +01:00
Quentin Fuxa and GitHub
66bc4a3733
Improve docs for _progressbar.py ( #1456 )
2025-01-09 12:21:21 -08:00
James R. Barlow
6edc749023
Fix error handling when PDF contains an invalid image with both ImageMask and ColorSpace set
...
Fixes #1453
2025-01-07 00:27:07 -08:00
James R. Barlow
bfbe571f12
docs: fix more rst formatting issues
2025-01-04 10:59:52 -08:00
James R. Barlow
522f9d5f56
Merge branch 'pr/pajowu/1448'
2025-01-01 18:00:52 -08:00
James R. Barlow
796e424ee5
graft: Handle stack underflow
2025-01-01 18:00:39 -08:00
James R. Barlow
d87db6cad0
Merge branch 'pr/pajowu/1446'
2025-01-01 17:50:33 -08:00
James R. Barlow
206bab74bc
Improve diagnostics for unidentified image
2025-01-01 17:13:57 -08:00
James R. Barlow
f71a5ffd61
hocr: comment typo
2024-12-23 01:46:00 -08:00
Kara Engelhardt
636623ab49
graft: fix invisible text appearing after strip_invisible_text
...
strip_invisible_text resets the text render mode on each `BT` (begin text) command. However the text state is not actually reset for each text element, only for each page.
The pdf reference says:
> The text state operators can appear outside text objects, and the values they set
> are retained across text objects in a single content stream. Like other graphics
> state parameters, these parameters are initialized to their default values at the
> beginning of each page.
>
> -- https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.7old.pdf#page=397
With the current implementation, a text object is only deleted if it contains a `3 Tr` command (setting the text rendering mode to invalid). However the rendering mode may be set once and then not changed for multiple text objects or set outside of a text object.
In that case only the first text object (which contains the `3 Tr`-command) is removed. This not only leaves the other text objects in the pdf, but also makes them visible, since the text object that contained the `3 Tr`-command is removed.
This PR updates `strip_invisible_text` to not reset the rendering mode for each object and to keep track of the rendering mode when the graphic state is pushed/popped.
2024-12-11 18:01:12 +01:00
Kara Engelhardt
74253e5fc8
hocr: only add space if boxwidth is positive
2024-12-11 16:23:45 +01:00
James R. Barlow
86d92ef490
Disable logging of markup
...
Fixes #1444
2024-12-08 12:17:19 -08:00
Ali MJ Al-Nasrawy
6d2d870711
Fix "Scanning contents" progress bar with --redo-ocr
2024-12-04 18:45:46 +03:00
James R. Barlow
fe89be5dc0
Fix test broken in commit 85d6fb8c
2024-11-27 15:44:12 -08:00
James R. Barlow
85d6fb8ce9
Don't use stdout for Ghostscript
...
Apparently, Ghostscript simply uses temporary files when asked to write to stdout. We're already using temporary files internally, so this eliminates some redundant copies.
2024-11-21 17:02:03 -08:00
James R. Barlow
a659f83d67
Remove invalid hyperlink annotations to satisfy Ghostscript 10.x during PDF/A conversion
...
Closes #1425
2024-11-16 19:02:10 -08:00
James R. Barlow
dbd3c93757
Fix issue with unpickling HOCRResult
...
Fixes [Bug]: HOCRResult.from_json() not unpickling correctly #1427
2024-11-10 02:05:57 -08:00
James R. Barlow
d303b42c86
Add documentation to PdfMinerState
2024-10-27 22:01:36 -07:00
James R. Barlow
f77f701a50
Fix quadratic time performance regression on scanning pages
2024-10-27 21:57:53 -07:00
James R. Barlow
bf62562787
Merge branch 'feature/docker-ubuntu-24'
2024-10-27 17:39:06 -07:00
James R. Barlow
6c6cbfd4d6
Make images extracted for jbig2enc optimization have unique filenames
...
Fixes #1396
2024-10-27 17:38:52 -07:00
James R. Barlow
ee5acbe94e
Repair PDF before all processing
...
Some PDFs choke both pdfminer.six and Ghostscript but the issues can be fixed first.
Fixes #1403
2024-10-27 17:37:46 -07:00
James R. Barlow
5e478a7774
do_get_pdfinfo: typing
2024-10-27 17:23:20 -07:00
James R. Barlow
fe4725658e
unpaper: fix regex
2024-10-27 14:57:21 -07:00
James R. Barlow
9d042767cc
Attempt to fix matrix and unpaper version error
2024-10-27 14:04:45 -07:00
James R. Barlow
6f755321b8
Ignore unpaper warning message when checking version
...
Fixes #1409
2024-10-27 13:06:30 -07:00
James R. Barlow
706681deb8
Improve some type checks
2024-10-27 12:54:29 -07:00
James R. Barlow
c283cf0a0d
Fix incorrect return value
2024-10-27 12:32:40 -07:00
James R. Barlow
0f82d7223e
Fix some typing issues
2024-10-27 12:31:16 -07:00
James R. Barlow
9a6150ae53
Refactor get_pdfinfo common code
2024-10-27 12:09:33 -07:00
James R. Barlow
fec0948a13
If inside a container, remind user that path is relative to container
2024-10-27 11:55:38 -07:00
James R. Barlow
18b59c57b4
Refactor our tests that check if we are in a container
2024-10-27 11:55:22 -07:00
James R. Barlow
944d99bdc1
Fix PROGRAM_NAME
2024-08-31 01:23:55 -07:00
James R. Barlow
b9dd0a5e3c
Use hatchling and hatch-vcs as build backend
2024-08-31 01:08:23 -07:00