Last active
February 18, 2021 17:12
-
-
Save erwan-lemonnier/a971f70c8b44ba9a44cf3c9ec5c45ec0 to your computer and use it in GitHub Desktop.
Revisions
-
erwan-lemonnier renamed this gist
Feb 18, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
erwan-lemonnier created this gist
Feb 18, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ 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), )