Initial MRP foundation scaffold

This commit is contained in:
2026-03-14 14:44:40 -05:00
commit ee833ed074
77 changed files with 10218 additions and 0 deletions

25
server/src/lib/pdf.ts Normal file
View File

@@ -0,0 +1,25 @@
import puppeteer from "puppeteer";
import { env } from "../config/env.js";
export async function renderPdf(html: string) {
const browser = await puppeteer.launch({
executablePath: env.PUPPETEER_EXECUTABLE_PATH,
headless: true,
args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage"],
});
try {
const page = await browser.newPage();
await page.setContent(html, { waitUntil: "networkidle0" });
return await page.pdf({
format: "A4",
printBackground: true,
preferCSSPageSize: true,
});
} finally {
await browser.close();
}
}