From 0c3110857eabcf6312c97a5e827ef63eaf8b95d2 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Mon, 8 Dec 2025 23:23:23 -0800 Subject: [PATCH] fix: add lossless_reconstruction to namespace options in PdfContext Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) --- src/ocrmypdf/_jobcontext.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ocrmypdf/_jobcontext.py b/src/ocrmypdf/_jobcontext.py index bb7c8fc1..293fc99c 100644 --- a/src/ocrmypdf/_jobcontext.py +++ b/src/ocrmypdf/_jobcontext.py @@ -42,7 +42,11 @@ class PdfContext: else: # Convert Namespace to OCROptions self.options = OCROptions.from_namespace(options) - self._namespace_options = options + self._namespace_options = self.options.to_namespace() + + # Ensure lossless_reconstruction is available on the namespace + if not hasattr(self._namespace_options, 'lossless_reconstruction'): + self._namespace_options.lossless_reconstruction = self.options.lossless_reconstruction self.work_folder = work_folder self.origin = origin self.pdfinfo = pdfinfo