Forum Discussion
Storyline 360 - Generating a PDF Certificate using JavaScript
i am SO super delighted that i've managed to ALMOST create a certificate. HOWEVER, I can't for the life of me work out how to get the variables in.
I have spent 3 hours on it and i'm going nuts.
also - not sure how everyone else gets their code in that fancy grey box......
function createPDF() {
var D1 = '';
var D2 = '';
var player = parent.GetPlayer();
D1 = player.GetVar("firstname");
D2 = player.GetVar("lastname");
//var docDefinition = { content: 'This is an sample PDF printed with pdfMake for '+name+"!" };
var docDefinition = {
content: [
{
table: {
heights: [100,100,100,100],
widths: [500],
headerRows: 3,
body: [
['Certificate of completion'],
[HOW THE HELL DO I GET THE VARIABLES HERE?],
['completed the eSafety Early Years module'],
['We SAY and SHARE with technology'],
]
},
style: 'header',
alignment: 'center',
layout: 'noBorders'
},