Created
December 8, 2017 19:55
-
-
Save Jonty/64501bb885a6f44f6f3f3a274b7a0ac8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from pyppeteer.launcher import launch | |
async def to_pdf(browser, url): | |
page = await browser.newPage() | |
await page.goto(url) | |
pdf = await page.pdf() | |
with open('emfcamp.pdf', 'wb') as f: | |
f.write(pdf) | |
url = "http://emfcamp.org" | |
browser = launch() | |
asyncio.get_event_loop().run_until_complete(to_pdf(browser, url)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment