Last active
February 18, 2021 17:12
-
-
Save erwan-lemonnier/a971f70c8b44ba9a44cf3c9ec5c45ec0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderer = PageRenderer() | |
pdf_document = load_from_file(pdf) | |
emails = [] | |
for page_number in range(pdf_document.pages): | |
page = pdf_document.create_page(page_number) | |
image = renderer.render_page(page) | |
# Convert pdf image to PIL image | |
pil_image = Image.frombytes( | |
"RGBA", | |
(image.width, image.height), | |
image.data, | |
"raw", | |
str(image.format), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment