Avoid call to deprecated pdf.check() where possible

This commit is contained in:
James R. Barlow
2025-08-13 01:15:33 -07:00
parent 8318ebbaec
commit 6af22051a8
+4 -1
View File
@@ -270,7 +270,10 @@ def check_pdf(input_file: Path) -> bool:
with pdf:
with warnings.catch_warnings():
warnings.filterwarnings('ignore', message=r'pikepdf.*JBIG2.*')
messages = pdf.check()
if hasattr(pdf, 'check_pdf_syntax'):
messages = pdf.check_pdf_syntax() # pikepdf >= 9.10.0
else:
messages = pdf.check()
success = True
for msg in messages:
if 'error' in msg.lower():