Answers for "pip install pdf2image"

9

python pdf to image

#The pdf2image library can be used
#You can install it simply using,

pip install pdf2image
#Once installed you can use following code to get images.

from pdf2image import convert_from_path
pages = convert_from_path('pdf_file', 500)

#Saving pages in jpeg format

for page in pages:
    page.save('out.jpg', 'JPEG')
Posted by: Guest on May-10-2020
0

pip img2pdf

import osimport img2pdfwith open("output.pdf", "wb") as f:    f.write(img2pdf.convert([i for i in os.listdir('.') if i.endswith(".jpg")]))
Posted by: Guest on May-02-2020

Python Answers by Framework

Browse Popular Code Answers by Language