备忘 nodejs生产pdf 组件 node-wkhtmltopdf
A Node.js wrapper for the wkhtmltopdf command line tool. As the name implies, it converts HTML documents to PDFs using WebKit.
[size=x-large][color=red]将Html 转换成PDF
[/color][/size]
下载地址
https://github.com/devongovett/node-wkhtmltopdf
http://wkhtmltopdf.org/index.html
[size=x-large]linux下wkhtmltopdf安装方法
[url]http://huqiji.iteye.com/blog/2278225[/url][/size]
[color=red]第一步,下载安装wkhtmltopdf 支持
第二部 , 安装 npm install wkhtmltopdf[/color]
调用
A Node.js wrapper for the wkhtmltopdf command line tool. As the name implies, it converts HTML documents to PDFs using WebKit.
[size=x-large][color=red]将Html 转换成PDF
[/color][/size]
下载地址
https://github.com/devongovett/node-wkhtmltopdf
http://wkhtmltopdf.org/index.html
[size=x-large]linux下wkhtmltopdf安装方法
[url]http://huqiji.iteye.com/blog/2278225[/url][/size]
[color=red]第一步,下载安装wkhtmltopdf 支持
第二部 , 安装 npm install wkhtmltopdf[/color]
调用
var wkhtmltopdf = require('wkhtmltopdf');
var fs = require("fs");
// URL
wkhtmltopdf('http://huqiji.iteye.com/', { pageSize: 'letter' })
.pipe(fs.createWriteStream('out.pdf'));
// HTML
wkhtmltopdf('<h1>Test</h1><p>Hello world</p>')
.pipe(res);
// output to a file directly
wkhtmltopdf('http://huqiji.iteye.com/', { output: 'out.pdf' });
// Optional callback
wkhtmltopdf('http://huqiji.iteye.com/', { pageSize: 'letter' }, function (code, signal) {
});
wkhtmltopdf('http://huqiji.iteye.com/', function (code, signal) {
});