More updates to resume script

This commit is contained in:
2026-07-24 18:03:05 -05:00
parent 6997bd011b
commit bb2a394db0
5 changed files with 50 additions and 20 deletions
+21 -20
View File
@@ -1,24 +1,25 @@
import { chromium } from 'playwright';
import { mkdir } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { chromium } from 'playwright'
import { mkdir } from 'node:fs/promises'
import { dirname, join, resolve } from 'node:path'
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const resumeHtml = resolve(root, 'public/resume/index.html');
const root = join(import.meta.dir, '..')
const resumeHtml = join(root, 'public/resume/index.html')
const outputPath = resolve(
process.argv[2] ?? resolve(root, 'public/resume/paper.pdf'),
);
Bun.argv[2] ?? join(root, 'public/resume/paper.pdf'),
)
async function main() {
await mkdir(dirname(outputPath), { recursive: true });
await mkdir(dirname(outputPath), { recursive: true })
const browser = await chromium.launch();
const page = await browser.newPage();
const browser = await chromium.launch()
const page = await browser.newPage()
await page.goto(`file://${resumeHtml}`, { waitUntil: 'networkidle' });
await page.goto(Bun.pathToFileURL(resumeHtml).href, {
waitUntil: 'networkidle',
})
await page.evaluate(async () => {
await document.fonts.ready;
});
await document.fonts.ready
})
await page.pdf({
path: outputPath,
@@ -30,13 +31,13 @@ async function main() {
bottom: '0',
left: '0',
},
});
})
await browser.close();
console.log(`Wrote ${outputPath}`);
await browser.close()
console.log(`Wrote ${outputPath}`)
}
main().catch((error) => {
console.error(error);
process.exit(1);
});
console.error(error)
process.exit(1)
})