Home > AI > Language > Python >

convert pdf to jpgs

# import module
from pdf2image import convert_from_path
 
 
# Store Pdf with convert_from_path function
images = convert_from_path('example.pdf')
 
for i in range(len(images)):
   
      # Save pages as images in the pdf
    images[i].save('page'+ str(i) +'.jpg', 'JPEG')

Reference:

https://www.geeksforgeeks.org/convert-pdf-to-image-using-python/

Leave a Reply