James R. Barlow and aider
530186b468
docs: update documentation for OCROptions plugin interface migration
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:46 -08:00
James R. Barlow and aider
7b37f57b1c
refactor: replace Namespace with OCROptions in plugins and validation
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:46 -08:00
James R. Barlow
d4b7165d72
fix: resolve pickling issue with Pydantic validators in PageContext
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
Fix pickling issue
2025-12-21 12:21:46 -08:00
James R. Barlow and aider
f5bfd2fd3e
Add compat function for pages_from_ranges
...
fix: handle Pydantic validation errors with correct exit code
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:46 -08:00
James R. Barlow and aider
7575dddefc
fix: add lossless_reconstruction attribute to OCROptions for compatibility
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
fix: resolve recursion error in lossless_reconstruction option
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
fix: ensure lossless_reconstruction attribute is added to Namespace
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
fix: ensure lossless_reconstruction attribute is correctly propagated to PageContext
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:49 -08:00
James R. Barlow and aider
66a3e8508e
feat: add comprehensive validators to OCROptions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
7bb3a97208
refactor: update test_validation.py to use Pydantic model validation
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
d2add01217
fix: remove deprecated set_lossless_reconstruction import and call
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
4476e81240
refactor: remove redundant validation functions from _validation.py
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
a373fcd649
fix: add jobs fallback in pipeline common
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow
87478bc240
Fix options.jpg_quality issue
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
04ad78f01d
refactor: replace OptimizeOptions with OCROptions in tests
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:58 -08:00
James R. Barlow and aider
62c3ae80c7
fix: ensure pickling compatibility for OCROptions in multiprocessing
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:58 -08:00
James R. Barlow
d556014185
Remove language warning
2025-12-13 11:41:58 -08:00
James R. Barlow and aider
d18efcbbf1
fix: support flexible type inputs for pages and unpaper_args
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:27 -08:00
James R. Barlow and aider
f9a4a2e240
fix: handle missing input_file in OCROptions namespace conversion
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:27 -08:00
James R. Barlow and aider
5f89100dc3
test: add lossless_reconstruction field to OCROptions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:27 -08:00
James R. Barlow and aider
1ef9aaf659
fix: Correct PDF/A part extraction and handle hOCR API output file
...
This commit addresses two issues:
1. Properly extract the PDF/A part from output_type
2. Add a placeholder output_file for hOCR API tests when output_folder is used
The changes include:
- Modifying `from_namespace` to add a placeholder output_file
- Updating PDF/A part extraction logic to handle different output_type formats
- Ensuring correct PDF/A part is passed to Ghostscript
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:27 -08:00
James R. Barlow and aider
4c4a1cfa17
fix: Resolve API test failures with pdf_renderer and output_file handling
...
This commit addresses several issues in the OCRmyPDF API:
- Fixed handling of 'auto' pdf_renderer by defaulting to 'hocr'
- Added placeholder for output_file when output_folder is present
- Updated model_fields access to use class method instead of instance attribute
- Improved error handling and default behavior in PDF rendering
Specifically:
- Modified `_options.py` to handle 'auto' pdf_renderer
- Updated attribute access to use class methods
- Added placeholder for output_file in special cases
- Updated `_pipelines/ocr.py` to handle 'auto' pdf_renderer
These changes resolve the test failures in `test_api.py` and improve the library's flexibility.
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:27 -08:00
James R. Barlow and aider
5251e21f7e
refactor: migrate OCROptions validators to Pydantic V2
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:40:57 -08:00
James R. Barlow and aider
28eb923d9f
feat: rename _extra_attrs to extra_attrs in OCROptions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:40:57 -08:00
James R. Barlow and aider
1579337ebe
refactor: Create OCROptions model with Namespace compatibility
...
This commit introduces a new `OCROptions` class in `_options.py` that provides:
- Proper typing for OCRmyPDF options
- Pydantic validation
- Backward compatibility with `argparse.Namespace`
- Gradual migration support for the options system
Key changes:
- Added comprehensive option fields with type hints
- Implemented custom attribute access methods
- Created conversion methods between Namespace and OCROptions
- Updated type hints in multiple files to support both types
- Maintained existing validation logic
The new model allows for a step-by-step refactoring of the options handling throughout the project.
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:40:57 -08:00
rugk and GitHub
8d715c4157
docs: fix and clarify podman usage instructions ( #1601 )
...
* docs: fix and clarify podman usage instructions
* the full reference `jbarlow83/ocrmypdf-alpine` as in the other commands may fix an issue if you do not have `ocrmypdf` already downloaded locally
* also clarified the command at the end for usage when SELinux is enabled
* docs: clarify difference between SeLinux and rootless user mapping
2025-12-01 13:07:09 -08:00
Chris Mayo and GitHub
9dbce33ee6
Update Changelog URL ( #1597 )
...
Renamed in:
d1a45e4a ("Convert remaining rst -> md", 2025-04-17)
2025-11-16 23:10:48 -08:00
James R. Barlow
54ce09496c
v16.12.0 release notes
v16.12.0
2025-11-11 13:48:06 -08:00
James R. Barlow
f4c6c8121b
Work around Ghostscript 10.6.0 JPEG encoding issue by forcing optimization.
...
Not an ideal fix, but it improves an issue affecting numerous users.
Fixes #1585 .
2025-11-10 17:01:02 -08:00
James R. Barlow
057eaff36d
Skip devnull testing on Windows
...
No longer seems to work - Windows Server 2025 change, perhaps? Doesn't really matter.
2025-11-10 16:57:30 -08:00
James R. Barlow
b88d63bdf7
Add Python 3.14 to test matrix
2025-11-10 16:10:01 -08:00
James R. Barlow
a385cd967d
docs: Improve ocrmypdf.api
2025-11-10 15:58:47 -08:00
James R. Barlow
2f72f8e94a
ghostscript: Disable subset fonts
...
For at least the PDF associated with this issue, disabling subset
fonts prevents Ghostscript from mangling the encoding when it is usable but not well-formed.
Fixes #1592
2025-11-10 15:58:14 -08:00
James R. Barlow and aider
ee47e986f3
docs: Improve module-level docstring for OCRmyPDF Python API
...
Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat >
2025-11-10 10:33:26 -08:00
James R. Barlow
e44063da15
Update Dockerfile versions
...
tesseract-ocr/alex-p does not have a Tesseract 5 for Ubuntu 25.10 so we use 25.04 for now.
Ubuntu 25.04 gets us Ghostscript 10.05 which avoids issues in older versions.
Remove comment about now-legacy Alpine versions not working properly. Alpine provides Ghostscript 10.05.1.
Fixes #1587 ,
2025-11-09 15:20:55 -08:00
James R. Barlow
abc2d41e2d
Require recent pikepdf to fix check_pdf_syntax issue
2025-10-29 11:40:51 -07:00
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
35ec90af44
Merge remote-tracking branches 'origin/dependabot/github_actions/sigstore/gh-action-sigstore-python-3.1.0', 'origin/dependabot/github_actions/actions/upload-artifact-5' and 'origin/dependabot/github_actions/actions/download-artifact-6'
2025-10-28 13:40:08 -07:00
James R. Barlow
aa1cc8ae04
Update packages
2025-10-27 17:07:14 -07:00
dependabot[bot] and GitHub
eaceb66030
Bump sigstore/gh-action-sigstore-python from 3.0.1 to 3.1.0
...
Bumps [sigstore/gh-action-sigstore-python](https://github.com/sigstore/gh-action-sigstore-python ) from 3.0.1 to 3.1.0.
- [Release notes](https://github.com/sigstore/gh-action-sigstore-python/releases )
- [Changelog](https://github.com/sigstore/gh-action-sigstore-python/blob/main/CHANGELOG.md )
- [Commits](https://github.com/sigstore/gh-action-sigstore-python/compare/v3.0.1...v3.1.0 )
---
updated-dependencies:
- dependency-name: sigstore/gh-action-sigstore-python
dependency-version: 3.1.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-10-27 11:08:50 +00:00
dependabot[bot] and GitHub
b1dcc2c445
Bump actions/upload-artifact from 4 to 5
...
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact ) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases )
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5 )
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-version: '5'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-10-27 11:02:08 +00:00
dependabot[bot] and GitHub
ab3855af48
Bump actions/download-artifact from 5 to 6
...
Bumps [actions/download-artifact](https://github.com/actions/download-artifact ) from 5 to 6.
- [Release notes](https://github.com/actions/download-artifact/releases )
- [Commits](https://github.com/actions/download-artifact/compare/v5...v6 )
---
updated-dependencies:
- dependency-name: actions/download-artifact
dependency-version: '6'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-10-27 10:47:34 +00:00
James R. Barlow
5c6cc4031f
Merge remote-tracking branch 'origin/dependabot/github_actions/astral-sh/setup-uv-7'
2025-10-25 12:10:01 -07:00
James R. Barlow
f181307e50
v16.11.1 release notes
v16.11.1
2025-10-16 10:59:13 +02: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
f59e68911f
Drop macos-13 (now unsupported by Apple)
2025-10-13 15:10:28 +02:00
dependabot[bot] and GitHub
9605656a2f
Bump astral-sh/setup-uv from 6 to 7
...
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv ) from 6 to 7.
- [Release notes](https://github.com/astral-sh/setup-uv/releases )
- [Commits](https://github.com/astral-sh/setup-uv/compare/v6...v7 )
---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
dependency-version: '7'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-10-13 10:40:31 +00:00
James R. Barlow
599fb1a1f6
Fix test_semfree (skip Python 3.14)
...
This feature is now deprecated and won't be fixed for Python 3.14. Instead we just use threads on platforms that don't support semaphores.
Closes #1558
2025-09-14 13:02:33 -07:00
James R. Barlow
9a2c0cf6ff
v16.11.0 release notes
v16.11.0
2025-09-12 00:08:11 -07: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
7ca4ae4e16
Merge branch 'feature/pdfa-naming'
2025-09-11 16:37:53 -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
clach04 and GitHub
d07231a7aa
Doc typo plugins.md ( #1568 )
2025-09-08 12:07:51 -07:00