首页 > Web开发 > 详细

nodjs html 转 pdf

时间:2019-07-03 22:52:07      阅读:106      评论:0      收藏:0      [点我收藏+]
var fs = require(‘fs‘);
var pdf = require(‘html-pdf‘);//模块
//读取html 文件
var html = fs.readFileSync(‘./static.html‘, ‘utf8‘);

//创建pdf
var options = { format: ‘Letter‘ };
pdf.create(html, options).toFile(‘./export.pdf‘, function(err, res) {
if (err) return console.log(err);
console.log(res); // { filename: ‘/app/businesscard.pdf‘ }
});

nodjs html 转 pdf

原文:https://www.cnblogs.com/yydown/p/11129314.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!