Dec 29, 2020
Thanks for a great introduction to Puppeteer. I just wanted to add that if your need simply is to generate a PDF file of a web page, you can also do this from the command line without resorting to Javascript.
Simply run...
/path/to/Google\ Chrome --headless --print-to-pdf=./file.pdf https://www.google.com/
(Replace /path/to with the appropriate path to your Chrome or Chromium executable)