parent
041c0ed6bb
commit
78205ee8c7
|
@ -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,14 @@ export class PdfCreator {
|
|||
}
|
||||
|
||||
//TODO: Accept the runner class
|
||||
public async generateSponsoringContract(): Promise<any> {
|
||||
public async generateSponsoringContract(runner: Runner): Promise<any> {
|
||||
console.log("runner")
|
||||
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 });
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
<h1>{{runner_id}}</h1>
|
||||
<h1>{{runner_firstname}}</h1>
|
||||
<h1>{{runner_lastname}}</h1>
|
||||
<h1>{{runner_groupname}}</h1>
|
||||
<h1>ID: {{runner_id}}</h1>
|
||||
<h1>FIRSTNAME: {{runner_firstname}}</h1>
|
||||
<h1>LASTNAME: {{runner_lastname}}</h1>
|
||||
<h1>GROUP: {{runner_groupname}}</h1>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue