phantom.js - HTML To PDF
- import phantom from 'phantom';
- const pageToPdf = (url) => {
- phantom.create().then((ph) {
- ph.createPage().then((page) => {
- page.open(url).then((status) => {
-
- page.render('存儲的地址.pdf').then((status) => {
- console.log('Page rendered');
- ph.exit();
- });
- });
- });
- });
- };
- pageToPdf('https://www.tongbanjie.com');
歡迎關注本站公眾號,獲取更多信息