0

Have written this python script to convert multi page pdfs to jpeg.

import requests, io
from pdf2image import convert_from_bytes

url = 'http://www.asx.com.au/asxpdf/20171108/pdf/43p1l61zf2yct8.pdf'
response = requests.get(url)
pages = convert_from_bytes(response.content)

in_mem_file = io.BytesIO()
for page in pages:
    page.save(in_mem_file, format="jpeg")
in_mem_file.seek(0)

f = open('./test3.jpeg', 'wb')
f.write(in_mem_file.read())
f.close()
in_mem_file.close()

But this gives the first page itself. Why am i not getting the second page in the output file.

Rahul
  • 895
  • 1
  • 13
  • 26

0 Answers0