Welcome to mirror list, hosted at ThFree Co, Russian Federation.

generatepdf.js « exampleSite - github.com/cssandstuff/hugo-theme-winning.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e85e6e3688c31257650ae76d92ac1392d54bb508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var fs = require('fs');
var pdf = require('html-pdf');
var html = fs.readFileSync('./docs/index.html', 'utf8');
var options = { 
  "format": 'A4',
  "border": {
    "top": "1cm",            // default is 0, units: mm, cm, in, px
    "right": "3cm",
    "bottom": "2cm",
    "left": "3cm"
  }
 };

pdf.create(html, options).toFile('./themes/winning/static/assets/cv.pdf', function(err, res) {
  if (err) return console.log(err);
  console.log(res); // { filename: '/app/businesscard.pdf' }
});