From dab9e466567b369b6c68af41fbf09c6b6a8ab803 Mon Sep 17 00:00:00 2001 From: Eetu Purontaus Date: Wed, 22 Jan 2025 12:53:35 +0200 Subject: [PATCH] Suppress output intent keyerror (#59) For non-compliant PDFs, output intent structure may be missing. Rather than logging an error, just debug and return. Also use the correct logger.exception() instead of error so the full exception gets logged. --- drafthorse/pdf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drafthorse/pdf.py b/drafthorse/pdf.py index 3b07377..a17709a 100644 --- a/drafthorse/pdf.py +++ b/drafthorse/pdf.py @@ -124,8 +124,10 @@ def _get_original_output_intents(original_pdf): "/DestOutputProfile" ].get_object() output_intents.append((ori_output_intent_dict, dest_output_profile_dict)) + except KeyError as ex: + logger.debug("Data missing from PDF: %s", ex) except Exception as ex: - logger.error(ex) + logger.exception(ex) return output_intents -- 2.47.3