`

phantom.js - HTML To PDF

 
阅读更多

HTML 转 pdf

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');

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics