Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Pull images from PDF

25 Apr 2020 » office, automation
pip install pdf2image
conda install -y -c conda-forge poppler
rs = requests.get("<pdf url>", stream=True)

pages = convert_from_bytes(rs.raw.read(), 200)

folder="./images/"
for idx,page in enumerate(pages):
    page.save('{}{}.png'.format(folder, idx), 'PNG')

https://stackoverflow.com/questions/51481200/convert-pdf-to-image-using-pdf-url-pdf2image/61417241#61417241 https://stackoverflow.com/questions/46184239/extract-a-page-from-a-pdf-as-a-jpeg