import phantom from 'phantom'; const pageToPdf = (url) => { phantom.create().then((ph) { ph.createPage().then((page) => { page.open(url).then((status) ...
- import phantom from 'phantom';
- const pageToPdf = (url) => {
- phantom.create().then((ph) {
- ph.createPage().then((page) => {
- page.open(url).then((status) => {
- // 配置存儲的pdf地址
- page.render('存儲的地址.pdf').then((status) => {
- console.log('Page rendered');
- ph.exit();
- });
- });
- });
- });
- };
- pageToPdf('https://www.tongbanjie.com');