Minor cleanup around pypdfium2 integration

This commit is contained in:
mara004
2025-05-02 23:07:05 +02:00
committed by Jeremy Singer-Vine
parent 7e364e6193
commit b88907fd0c
+1 -3
View File
@@ -55,7 +55,7 @@ def get_page_image(
try: try:
pdfium_doc = pypdfium2.PdfDocument(src, password=password) pdfium_doc = pypdfium2.PdfDocument(src, password=password)
except pypdfium2._helpers.misc.PdfiumError as e: except pypdfium2.PdfiumError as e:
raise MalformedPDFException(e) raise MalformedPDFException(e)
pdfium_page = pdfium_doc.get_page(page_ix) pdfium_page = pdfium_doc.get_page(page_ix)
@@ -69,8 +69,6 @@ def get_page_image(
# Non-modifiable arguments # Non-modifiable arguments
prefer_bgrx=True, prefer_bgrx=True,
).to_pil() ).to_pil()
# In theory `autoclose` when creating it should make it close...
# automatically. In practice this does not seem to be the case.
pdfium_doc.close() pdfium_doc.close()
return img.convert("RGB") return img.convert("RGB")