Skip to content

Instantly share code, notes, and snippets.

@iurisilvio
Created November 6, 2012 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iurisilvio/4024082 to your computer and use it in GitHub Desktop.
Save iurisilvio/4024082 to your computer and use it in GitHub Desktop.
Use pdfcrowd url to pdf to create server side pdfs
import requests
response = requests.get('http://pdfcrowd.com/url_to_pdf/?pdf_name=google.pdf',
headers={'Referer': 'http://www.google.com'})
filename = response.headers['content-disposition'].split('"')[1]
with file(filename, 'w+b') as f:
f.write(response.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment