mirror of
https://github.com/r-ca/md2pdf-meow.git
synced 2024-11-22 15:43:15 +00:00
test
This commit is contained in:
parent
326cb143c4
commit
e7d97d04cf
|
@ -0,0 +1,18 @@
|
|||
import PuppeteerHTMLPDF from "puppeteer-html-pdf";
|
||||
|
||||
const htmlPdf = new PuppeteerHTMLPDF();
|
||||
|
||||
htmlPdf.setOptions({
|
||||
format: "A4",
|
||||
});
|
||||
|
||||
const html = await htmlPdf.readFile(`${__dirname}/dist/all.html`, "utf8");
|
||||
|
||||
try {
|
||||
const pdfBuffer = await htmlPdf.create(html);
|
||||
const path = `${__dirname}/dist/result.pdf`;
|
||||
await htmlPdf.writeFile(pdfBuffer, path);
|
||||
console.log("PDF created successfully");
|
||||
} catch (error) {
|
||||
console.error("Error creating PDF", error);
|
||||
}
|
Loading…
Reference in New Issue
Block a user