html-to-pdf-studio
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "html-to-pdf-studio", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Converting HTML template to PDF files", | ||
@@ -29,3 +29,3 @@ "main": "src/index.js", | ||
"handlebars": "^4.1.2", | ||
"puppeteer": "~1.10.0" | ||
"puppeteer": "^1.15.0" | ||
}, | ||
@@ -38,4 +38,6 @@ "devDependencies": { | ||
"nodemon": "^1.19.0", | ||
"npm-run-all": "^4.1.5" | ||
"npm-run-all": "^4.1.5", | ||
"stylelint": "^10.0.1", | ||
"stylelint-config-recommended": "^2.2.0" | ||
} | ||
} |
@@ -22,3 +22,3 @@ # html-to-pdf-studio | ||
Compiling a [handlebars HTML template](./templates/invoice.hbs) | ||
Compiling a [handlebars HTML template](./example/templates/index.html) | ||
@@ -28,11 +28,11 @@ ```javascript | ||
const path = require("path"); | ||
const { compileHTML } = require("html-to-pdf-studio"); | ||
const { compileHTML, createPDF } = require("html-to-pdf-studio"); | ||
const cssPath = path.join(__dirname, "./templates/style.css"); | ||
const cssPath = path.join(__dirname, "./example/templates/style.css"); | ||
const css = fs.readFileSync(cssPath, "utf8"); | ||
const htmlPath = path.join(__dirname, "./templates/invoice.hbs"); | ||
const htmlPath = path.join(__dirname, "./example/templates/index.html"); | ||
const html = fs.readFileSync(htmlPath, "utf8"); | ||
let data = require("./templates/data.json"); | ||
let data = require("./example/templates/data.json"); | ||
const dataBinding = Object.assign(data, { css }); | ||
@@ -50,3 +50,3 @@ | ||
const fileName = "invoide.pdf"; | ||
const outputPath = path.join(__dirname, "./output"); | ||
const outputPath = path.join(__dirname, "./example/output"); | ||
@@ -75,3 +75,3 @@ if (!fs.existsSync(outputPath)) fs.mkdirSync(outputPath); | ||
[tranchuong][6] - [html_to_pdf][7] | ||
[tranchuong][5] - [html_to_pdf][6] | ||
@@ -86,4 +86,3 @@ ### License | ||
[4]: https://www.npmjs.com/package/html-to-pdf-studio | ||
[5]: https://dependabot.com | ||
[6]: https://github.com/chuongtrh | ||
[7]: https://github.com/chuongtrh/html_to_pdf | ||
[5]: https://github.com/chuongtrh | ||
[6]: https://github.com/chuongtrh/html_to_pdf |
@@ -7,2 +7,3 @@ const puppeteer = require('puppeteer'); | ||
* @param {Object} pdfOptions Puppeteer page PDF | ||
* @return {Buffer} PDF Buffer | ||
*/ | ||
@@ -18,6 +19,8 @@ const createPDF = async (html, pdfOptions) => { | ||
}); | ||
await page.pdf(pdfOptions); | ||
const pdf = await page.pdf(pdfOptions); | ||
await browser.close(); | ||
return pdf; | ||
}; | ||
module.exports = createPDF; |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
64909
19
8
89
84
1
+ Addeddebug@4.4.0(transitive)
+ Addedpuppeteer@1.20.0(transitive)
+ Addedws@6.2.3(transitive)
- Removedpuppeteer@1.10.0(transitive)
- Removedws@5.2.4(transitive)
Updatedpuppeteer@^1.15.0