This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
localUrlAccess: true
in #616 using https://github.com/marcbachmann/node-html-pdf/pull/623 support as the option accidentally got invertedlocalUrlAccess: false
optionPrevent local file access by default to fix a security issue.
Please provide the localUrlAccess: true
option if you want to keep the old behavior
but keep your system vulnerable to local file access.
Not sure this module is even usable without installing phantomjs manually. On linux you might need to download the executable.
The tests are running locally on macos.
Fix options.directory that can be used as tmp path #117
You can use tags with ids in your html to get custom headers and footers:
<div id="pageHeader">Default header</div>
<div id="pageHeader-first">Header on first page</div>
<div id="pageHeader-2">Header on second page</div>
<div id="pageHeader-3">Header on third page</div>
<div id="pageHeader-last">Header on last page</div>
...
<div id="pageFooter">Default footer</div>
<div id="pageFooter-first">Footer on first page</div>
<div id="pageFooter-2">Footer on second page</div>
<div id="pageFooter-last">Footer on last page</div>
Catch phantomjs errors 517d307
new module API #11
pdf = require('html-pdf')
pdf.create(html).toFile(filepath, function(err, res){
console.log(res.filename);
});
pdf.create(html).toStream(function(err, stream){
steam.pipe(fs.createWriteStream('./foo.pdf'));
});
pdf.create(html).toBuffer(function(err, buffer){
console.log('This is a buffer:', Buffer.isBuffer(buffer));
});