htmltobase64
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "htmltobase64", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "turns an html webpage into a base64 encoded image", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,18 +7,19 @@ # HtmlToBase64 | ||
const htmlToBase64 = require("html2base64") | ||
let width = 1280; | ||
let height = 1080; | ||
let replacements = { | ||
user: "dwiftejb" | ||
} // replace anything that has {{key}} to value | ||
let selector = "body"; // selects the element to screenshot and save as base64, leave empty to screenshot whole page. | ||
```js | ||
const htmlToBase64 = require("htmltobase64") | ||
let width = 1280; | ||
let height = 1080; | ||
async function main() { | ||
const base64 = await htmlToBase64("<h1>hello {{user}}</h1>", width, height, replacements, selector); | ||
console.log(base64); | ||
} | ||
let replacements = { | ||
user: "dwiftejb" | ||
} // replace anything that has {{key}} to value | ||
main(); | ||
let selector = "body"; // selects the element to screenshot and save as base64, leave empty to screenshot whole page. | ||
async function main() { | ||
const base64 = await htmlToBase64("<h1>hello {{user}}</h1>", width, height, replacements, selector); | ||
console.log(base64); | ||
} | ||
main(); | ||
``` |
25
2429