Use pdfium's *public* (not private) render method

Thanks to @mara004 for flagging here:
https://github.com/jsvine/pdfplumber/discussions/899#discussioncomment-6520928
This commit is contained in:
Jeremy Singer-Vine
2023-07-23 18:19:50 -04:00
parent 90742bdcbc
commit 28f4ebeb3c
+7 -10
View File
@@ -49,23 +49,20 @@ def get_page_image(
stream.seek(0)
src = stream
img: PIL.Image.Image = pypdfium2.PdfDocument._process_page(
# Modifiable arguments
page_ix,
input_data=src,
pdfium_page = pypdfium2.PdfDocument(
src,
password=password,
).get_page(page_ix)
img: PIL.Image.Image = pdfium_page.render(
# Modifiable arguments
scale=resolution / 72,
no_smoothtext=not antialias,
no_smoothpath=not antialias,
no_smoothimage=not antialias,
# Non-modifiable arguments
renderer=pypdfium2._helpers.page.PdfPage.render,
converter=pypdfium2.PdfBitmap.to_pil,
prefer_bgrx=True,
pass_info=False,
need_formenv=False,
mk_formconfig=None,
)
).to_pil()
return img.convert("RGB")