fix pdf generation

master
Igor Laborie 5 years ago
parent c1f11faedc
commit 128653dd1b
  1. 2
      .gitignore
  2. BIN
      static/schedule/schedule.pdf
  3. 7
      tools/pdf.js

2
.gitignore vendored

@ -5,3 +5,5 @@ node_modules/
.idea/ .idea/
.vscode/ .vscode/
yarn-error.log yarn-error.log
static/schedule/schedule*.pdf

Binary file not shown.

@ -9,6 +9,7 @@ Logger.config.defaultLevel = LogLevel.Debug;
const logger = Logger.getLogger('pdf'); const logger = Logger.getLogger('pdf');
// Configuration // Configuration
const output = 'static/schedule/schedule.pdf';
const serverConf = { const serverConf = {
port: 8765, port: 8765,
options: { options: {
@ -93,13 +94,11 @@ async function cleanupBeforePrint(page) {
logger.debug("done", pageResponse.statusText()); logger.debug("done", pageResponse.statusText());
await cleanupBeforePrint(page); await cleanupBeforePrint(page);
logger.info('export pdf', output);
logger.info('export pdf');
const path = 'static/schedule/schedule.pdf';
const format = 'A3'; const format = 'A3';
const scale = .4; const scale = .4;
const printBackground = true; const printBackground = true;
await page.pdf({path, format, scale, printBackground}); await page.pdf({path:output, format, scale, printBackground});
logger.debug("pdf done"); logger.debug("pdf done");
} catch (e) { } catch (e) {

Loading…
Cancel
Save