parent
041c0ed6bb
commit
ba7cedd187
@ -1,6 +1,7 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import puppeteer from "puppeteer";
|
import puppeteer from "puppeteer";
|
||||||
|
import { Runner } from './models/Runner';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is responsible for all things pdf creation.
|
* This class is responsible for all things pdf creation.
|
||||||
@ -17,9 +18,13 @@ export class PdfCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Accept the runner class
|
//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');
|
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 });
|
return await this.renderPdf(template, { format: "A5", landscape: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<h1>{{runner_id}}</h1>
|
<h1>ID: {{runner_id}}</h1>
|
||||||
<h1>{{runner_firstname}}</h1>
|
<h1>FIRSTNAME: {{runner_firstname}}</h1>
|
||||||
<h1>{{runner_lastname}}</h1>
|
<h1>LASTNAME: {{runner_lastname}}</h1>
|
||||||
<h1>{{runner_groupname}}</h1>
|
<h1>GROUP: {{runner_groupname}}</h1>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user