How nodejs converts html to pdf

for example, how to print its contents into a pdf file through the address of a html

Mar.28,2021

this operation can be done by looking for a three-party package.

The first result of

Google has a https://www.npmjs.com/package/html-pdf, < del > but uses the dead project phantomjs as the renderer, which is not recommended. < / del >

passers-by who do not answer questions, please do not casually report other people's hand-holding parties. Everyone is a hand-holding party, but you are ashamed to be silent when you reach out your hand.


puppteer
can be installed via npm

const puppeteer = require('puppeteer');
(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://www.baidu.com');
  await page.pdf({path: 'baidu.pdf', format: 'A4'});
  await browser.close();
})();

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9dd3f-466cd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9dd3f-466cd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?