parent
3e2b011d28
commit
75d2ac3c5f
|
@ -2,15 +2,18 @@ import axios from 'axios';
|
|||
import bwipjs from "bwip-js";
|
||||
import cheerio from "cheerio";
|
||||
import fs from "fs";
|
||||
import Handlebars from 'handlebars';
|
||||
import handlebars from 'handlebars';
|
||||
import i18next from "i18next";
|
||||
import Backend from 'i18next-fs-backend';
|
||||
import mime from "mime-types";
|
||||
import path from 'path';
|
||||
import { PDFDocument } from 'pdf-lib';
|
||||
import promisedHandlebars from "promised-handlebars";
|
||||
import puppeteer from "puppeteer";
|
||||
import { Runner } from './models/Runner';
|
||||
import { RunnerGroup } from './models/RunnerGroup';
|
||||
|
||||
const Handlebars = promisedHandlebars(handlebars);
|
||||
/**
|
||||
* This class is responsible for all things pdf creation.
|
||||
* This uses the html templates from src/templates.
|
||||
|
@ -68,7 +71,6 @@ export class PdfCreator {
|
|||
'--use-gl=swiftshader',
|
||||
'--no-sandbox'
|
||||
];
|
||||
|
||||
await i18next
|
||||
.use(Backend)
|
||||
.init({
|
||||
|
@ -85,7 +87,8 @@ export class PdfCreator {
|
|||
);
|
||||
await Handlebars.registerHelper('--bc',
|
||||
function (str) {
|
||||
return "data:image";
|
||||
//TODO: Fix the async behaviour
|
||||
return PdfCreator.generateBarcode("code39", str.toString());
|
||||
}
|
||||
);
|
||||
this.browser = await puppeteer.launch({ headless: true, args: minimal_args });
|
||||
|
|
Loading…
Reference in New Issue