I am using pypdfium2 version 4.5.0, I am facing this problem
I want to make use of this render_topil
pdf = pdfium.PdfDocument(pdf_path)
page = pdf.get_page(0)
pil_image = page.render_topil(scale = 300/72)
image_name = f"Images/{image_name}.jpg"
pil_image.save(image_name)
Pypdfium2 version 4 removed the render_topil method. As of version 4.9.0 the correct way to convert a Pypdfium2 Page object to PIL image following your code snippet is:
pdf = pdfium.PdfDocument(pdf_path)
page = pdf.get_page(0)
pil_image = page.render(scale = 300/72).to_pil()
image_name =f"Images/{image_name}.jpg"
pil_image.save(image_name)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With