title: Python3: Download PDF to memory and convert first page to image
body: <p>i try to do the following:</p>
  
  <ul>
  <li>Download a PDF file to memory</li>
  <li>Convert the first page to an image</li>
  <li>Use that image with tweepy</li>
  </ul>
  
  <p>I tried the following code, but run into an error. </p>
  
  <pre><code>from PIL import Image
  from pdf2image import convert_from_path
  from urllib.request import urlopen
  from io import StringIO, BytesIO
  
  url = 'http://somedomain.com/assets/applets/internet.pdf'
  scrape = urlopen(url) # for external files
  pdfFile = BytesIO(scrape.read())
  pdfFile.seek(0)
  pages = convert_from_path(pdfFile,last_page=1, dpi=100)
  
  for page in pages:
      page.save('/home/out.jpg', 'JPEG')
  </code></pre>
  
  <p>Here is the error:</p>
  
  <pre><code>TypeError: Can't convert '_io.BytesIO' object to str implicitly
  </code></pre>
  
  <p>The generated image should later be used to upload it to twitter by tweepy. I don't need to store it to disk, that's why i try to do all in memory.
  Anybody who could help me please?</p>