Implemented the basics for templateing feature/3-pdf_templateing #4

Merged
niggl merged 12 commits from feature/3-pdf_templateing into dev 2021-02-03 17:02:02 +00:00
Showing only changes of commit 3ca38abe93 - Show all commits

View File

@ -8,10 +8,11 @@ import path from 'path';
export class PdfCreator { export class PdfCreator {
private templateDir = path.join(__dirname, '/templates'); private templateDir = path.join(__dirname, '/templates');
//TODO: Accept the runner class
public async generateSponsoringContract(): Promise<any> { public async generateSponsoringContract(): Promise<any> {
const template = fs.readFileSync(`${this.templateDir}/sponsoring_contract.html`, 'utf8'); let template = fs.readFileSync(`${this.templateDir}/sponsoring_contract.html`, 'utf8');
let pdf = await pdf_converter.create(template, { format: "A5", orientation: "landscape" }); template = template.replace("{{Runner Name}}", "lelele");
return await this.toBuffer(pdf); return await pdf_converter.create(template, { format: "A5", orientation: "landscape" });
} }
/** /**