1#The pdf2image library can be used
2#You can install it simply using,
3
4pip install pdf2image
5#Once installed you can use following code to get images.
6
7from pdf2image import convert_from_path
8pages = convert_from_path('pdf_file', 500)
9
10#Saving pages in jpeg format
11
12for page in pages:
13 page.save('out.jpg', 'JPEG')
1#The pdf2image library can be used
2#You can install it simply using,
3pip install pdf2image
4
5#Also need to install poppler library using,
6pip install poppler
7#Once installed you can use following code to get images.
8
9from pdf2image import convert_from_path
10pages = convert_from_path('my_pdf_file.pdf', 500)
11
12#Saving pages in png format
13
14for i, page in enumerate(pages):
15 pname = 'page' + str(i) + '.png'
16 page.save(pname, 'PNG')