printout
This commit is contained in:
parent
58213923e5
commit
9da2a98f55
12 changed files with 341 additions and 54 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue