From 5118dc6242470c1bce2096c68f88eb55004e04ae Mon Sep 17 00:00:00 2001 From: Nicolas Ronvel Date: Tue, 9 Feb 2016 19:04:40 +0100 Subject: [PATCH] Issue #3 - PDF Generation for the Credits --- generator/scripts/pdf.js | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/generator/scripts/pdf.js b/generator/scripts/pdf.js index c22f7ed..6db6f5d 100644 --- a/generator/scripts/pdf.js +++ b/generator/scripts/pdf.js @@ -10,19 +10,27 @@ function generate_pdf() styles: get_pdf_style() }; - // Generation of the Sections + pdf_add_introduction(docDefinition.content, jsonPlayset); + + // Generation of the Sections (Relationships, Needs, Locations, Objects) for(var iSection = 0; iSection < jsonPlayset.sections.length; iSection++) { var currentSection = jsonPlayset.sections[iSection]; pdf_add_section(docDefinition.content, currentSection, jsonPlayset.teaser); } - pdfMake.createPdf(docDefinition).download(); + var customFilename = "Fiasco Playset - " + $('#input_title').val() + ".pdf"; + pdfMake.createPdf(docDefinition).download(customFilename); } function pdf_add_introduction(content, jsonPlayset) { - + // Title + content.push({ text: jsonPlayset.title, style: 'title', pageOrientation: 'portrait'}); + content.push({ text: 'Credits', style: 'subTitle'}); + content.push({ text: jsonPlayset.credits, style: 'description'}); + content.push({ text: 'Boilerplate', style: 'subTitle'}); + content.push({ text: jsonPlayset.credits, style: 'description'}); } /** @@ -89,6 +97,23 @@ function get_pdf_style() fontSize: 12, marginLeft: 22, marginTop: 1 + }, + title: { + fontSize: 32, + bold: true, + marginBottom: 8, + color: '#AA2222', + alignment: 'center' + }, + subTitle: { + fontSize: 26, + bold: true, + marginLeft: 10, + marginTop: 16 + }, + description: { + fontSize: 16, + marginBottom: 6 } }; return styles;