Shadow_Generator/html-to-png.js

15 lines
318 B
JavaScript
Raw Permalink Normal View History

2022-10-07 13:54:17 +02:00
import { Puppeteer } from "puppeteer";
export default async function (html) {
const browser = await Puppeteer.launch();
const page = await browser.newPage();
await page.setContent(html);
const file = await page.screenshot({ type: "png" });
await page.close();
await browser.close();
return file;
}