@@ -1,6 +1,7 @@
|
||||
import fs from "fs";
|
||||
import path from 'path';
|
||||
import puppeteer from "puppeteer";
|
||||
import { Runner } from './models/Runner';
|
||||
|
||||
/**
|
||||
* This class is responsible for all things pdf creation.
|
||||
@@ -17,9 +18,13 @@ export class PdfCreator {
|
||||
}
|
||||
|
||||
//TODO: Accept the runner class
|
||||
public async generateSponsoringContract(): Promise<any> {
|
||||
public async generateSponsoringContract(runner: Runner): Promise<any> {
|
||||
let template = fs.readFileSync(`${this.templateDir}/sponsoring_contract.html`, 'utf8');
|
||||
template = template.replace("{{Runner Name}}", "lelele");
|
||||
template = template
|
||||
.replace("{{runner_id}}", runner.id.toString())
|
||||
.replace("{{runner_firstname}}", runner.firstname)
|
||||
.replace("{{runner_lastname}}", runner.lastname)
|
||||
.replace("{{runner_groupname}}", runner.group.id.toString());
|
||||
return await this.renderPdf(template, { format: "A5", landscape: true });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user