- 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');
phantom.js - HTML To PDF
猜你喜欢
转载自www.cnblogs.com/mjian/p/9385703.html
今日推荐
周排行