Implement Custom CSS Feature

This commit is contained in:
Amruth Pillai
2025-01-13 00:31:49 +01:00
parent 7fb0226ddc
commit 43c5a33773
23 changed files with 465 additions and 17 deletions

View File

@ -150,6 +150,17 @@ export class PrinterService {
return temporaryHtml_;
}, pageElement);
// Apply custom CSS if enabled
const css = resume.data.metadata.css;
if (css.visible) {
await page.evaluate((cssValue: string) => {
const styleTag = document.createElement("style");
styleTag.textContent = cssValue;
document.head.append(styleTag);
}, css.value);
}
const uint8array = await page.pdf({ width, height, printBackground: true });
const buffer = Buffer.from(uint8array);
pagesBuffer.push(buffer);