node.js - node-html-pdf businesscard example on Ubuntu -
i trying use node-html-pdf (https://github.com/marcbachmann/node-html-pdf) node module on ubuntu 16.04 , have started given businesscard example.
unfortunately not able generate pdf.
first of all, installed module locally.
then copied businesscard.html , image.png project , tried execute following code no changes in it:
var fs = require('fs'); var pdf = require('html-pdf'); var html = fs.readfilesync('./test/businesscard.html', 'utf8'); var options = { format: 'letter' }; pdf.create(html, options).tofile('./businesscard.pdf', function(err, res) { if (err) return console.log(err); console.log(res); // { filename: '/app/businesscard.pdf' } });
the result pdf 2 black pages (ok), correct texts, format larger, font not right , not image in it.
looks basic configuration, missing path or similar...
any clues?
my guess if open .html
file browser have same (or similar) output.
probably link image src broken , font isn't imported.
maybe try making own basic html , parse pdf, should expect .pdf
similar .html
Comments
Post a Comment