This commit is contained in:
Julian Krauser 2024-10-19 16:24:41 +02:00
parent 58213923e5
commit 9da2a98f55
12 changed files with 341 additions and 54 deletions

View file

@ -22,11 +22,21 @@ export abstract class PdfExport {
return readFileSync(process.cwd() + "/src/templates/" + template, "utf8");
}
static async renderFile({ template, title, data }: { template: string; title: string; data: any }) {
static async renderFile({
template,
title,
filename,
data,
}: {
template: string;
title: string;
filename: string;
data: any;
}) {
let document = {
html: this.getTemplate(template),
data,
path: process.cwd() + `/export/${title}.pdf`,
path: process.cwd() + `/export/${filename}.pdf`,
};
await pdf.create(document, options(title));