mirror of
https://github.com/jsvine/pdfplumber.git
synced 2026-08-29 08:34:23 +08:00
Minor cleanup around pypdfium2 integration
This commit is contained in:
committed by
Jeremy Singer-Vine
parent
7e364e6193
commit
b88907fd0c
@@ -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")
|
||||||
|
|||||||
Reference in New Issue
Block a user