Skip to content

Commit

Permalink
Issue #3 - PDF Generation for the Credits
Browse files Browse the repository at this point in the history
  • Loading branch information
Gulix committed Feb 9, 2016
1 parent d6491a2 commit 5118dc6
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions generator/scripts/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
}

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5118dc6

Please sign in to comment.