docs: update documentation for OCROptions plugin interface migration

Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
James R. Barlow
2025-12-21 12:21:46 -08:00
co-authored by aider
parent 7b37f57b1c
commit 530186b468
4 changed files with 52 additions and 0 deletions
+12
View File
@@ -117,3 +117,15 @@ handler. OCRmyPDF will clean up its temporary files and worker processes
automatically when an exception occurs.
When OCRmyPDF succeeds conditionally, it returns an integer exit code.
### Plugin Development Changes
Starting in OCRmyPDF v16.13.0, the plugin interface has been updated:
- Plugin hooks now receive `OCROptions` objects instead of `argparse.Namespace`
- `OCROptions` provides the same attribute access as `Namespace` (duck-typing compatible)
- Plugin developers should update type hints: `from ocrmypdf._options import OCROptions`
- Built-in plugins no longer modify options in-place for better immutability
Most existing plugins will continue working without modification due to the
duck-typing compatibility between `OCROptions` and `Namespace`.