Created
September 15, 2021 17:31
-
-
Save Jragon/fcfad922f0ac8df3679e0e7061b83cf4 to your computer and use it in GitHub Desktop.
This file contains 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 import launch | |
async def main(): | |
browser = await launch() | |
page = await browser.newPage() | |
await page.setContent(""" | |
<!DOCTYPE html> | |
<html> | |
<body> | |
<h1>My First Heading</h1> | |
<p>My first paragraph.</p> | |
</body> | |
</html> | |
""") | |
await page.pdf({'path': 'example.pdf'}) | |
await browser.close() | |
asyncio.get_event_loop().run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment