1var fs = require('fs'),
2 convertFactory = require('electron-html-to');
3
4var conversion = convertFactory({
5 converterPath: convertFactory.converters.PDF
6});
7
8conversion({ html: '<h1>Hello World</h1>' }, function(err, result) {
9 if (err) {
10 return console.error(err);
11 }
12
13 console.log(result.numberOfPages);
14 console.log(result.logs);
15 result.stream.pipe(fs.createWriteStream('/path/to/anywhere.pdf'));
16 conversion.kill(); // necessary if you use the electron-server strategy, see bellow for details
17});
1myName = 'Chris';
2
3function logName() {
4 console.log(myName);
5}
6
7logName();
8
9var myName;