Move to weasyprint
This commit is contained in:
19
build.js
19
build.js
@@ -1,7 +1,6 @@
|
||||
const ejs = require("ejs");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const puppeteer = require("puppeteer");
|
||||
|
||||
// File paths
|
||||
const dataPath = path.join(__dirname, "content.json");
|
||||
@@ -18,20 +17,4 @@ const html = ejs.render(template, jsonData);
|
||||
// Write the output
|
||||
fs.writeFileSync(outputPath, html, "utf-8");
|
||||
|
||||
console.log(`Successfully generated resume at ${outputPath}`);
|
||||
|
||||
async function generatePdf(htmlPath) {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.goto(`file://${htmlPath}`, {
|
||||
waitUntil: "networkidle2",
|
||||
});
|
||||
// Saves the PDF to hn.pdf.
|
||||
await page.pdf({
|
||||
path: "resume.pdf",
|
||||
});
|
||||
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
generatePdf(outputPath).then(() => console.log("Generated PDF version"));
|
||||
console.log(`Successfully generated html resume at ${outputPath}`);
|
||||
|
||||
Reference in New Issue
Block a user