Skip to content

Commit

Permalink
Merge pull request #3 from juniorterin/patch-2
Browse files Browse the repository at this point in the history
Update pdf.js
  • Loading branch information
chuongtrh authored Jul 9, 2020
2 parents e420408 + 8abacec commit 8760f16
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ try {

var templateHtml = fs.readFileSync(path.join(process.cwd(), 'invoice.html'), 'utf8');
var template = handlebars.compile(templateHtml);
var finalHtml = template(dataBinding);
var finalHtml = encodeURIComponent(template(dataBinding));
var options = {
format: 'A4',
headerTemplate: "<p></p>",
Expand All @@ -44,7 +44,7 @@ try {
headless: true
});
const page = await browser.newPage();
await page.goto(`data:text/html,${finalHtml}`, {
await page.goto(`data:text/html;charset=UTF-8,${finalHtml}`, {
waitUntil: 'networkidle0'
});
await page.pdf(options);
Expand All @@ -54,4 +54,4 @@ try {
})();
} catch (err) {
console.log('ERROR:', err);
}
}

0 comments on commit 8760f16

Please sign in to comment.