Last active
August 31, 2020 00:41
-
-
Save toast38coza/9e34888e7567058f58e10cf56cb1ff1b to your computer and use it in GitHub Desktop.
Download a pdf of a webpage using puppeteer
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
const puppeteer = require('puppeteer'); | |
const fs = require('fs'); | |
const URL = https://apexcharts.com/" // set this to the url you want to generate a pdf of | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
await page.goto(URL, {waitUntil: 'networkidle2'}); | |
await page.pdf({path: 'download.pdf', format: 'A4'}); | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment