v17.4.0

ocrmypdf/OCRmyPDFv17.4.0Jul 17, 2026by github-actions[bot]

AI Summary

This release introduces a safety feature to prevent output file overwriting, fixes critical rendering bugs in the fpdf2 renderer, and resolves crashes related to optimization settings and PDF validation checks.

Key Highlights

  • Added `--no-overwrite` / `-n` option to prevent overwriting output files (exits with code 5 if the file exists)
  • Fixed text layer stretching in the fpdf2 renderer for widely-spaced words
  • Fixed crash in `optimize=2` or `optimize=3` when using the Python API without explicitly setting quality parameters
  • Fixed `verapdf` availability check crashing with `NotADirectoryError` on some platforms

New Features

  • `--no-overwrite` / `-n` option to prevent overwriting existing files

Full Release Notes

- Added ``--no-overwrite`` / ``-n`` option to prevent overwriting output files.
  If the destination file already exists, OCRmyPDF exits with code 5
  (``OutputFileAccessError``). {issue}`1642`
- Fixed text layer stretching in the fpdf2 renderer for widely-spaced words.
  The horizontal scaling (Tz) was incorrectly stretched to fill inter-word gaps
  instead of relying on Td positioning, causing text selection to highlight far
  beyond the actual word boundaries. {issue}`1635`
- Fixed ``optimize=2`` or ``optimize=3`` crash when using the Python API without
  explicitly setting ``jpg_quality`` or ``png_quality``. {issue}`1641`
- Fixed ``verapdf`` availability check crashing with ``NotADirectoryError`` on
  some platforms. {issue}`1638`