Forum Discussion
Saving Storyline Variables to a PDF
//Retrieve Player Variables
var player = GetPlayer();
userName = player.GetVar("userNote1");
userNotes = player.GetVar("userNote2");
//Create PDF
var doc = new jsPDF('landscape');
//Create Split Text Variable
var splitNotes = doc.splitTextToSize(userNotes, 550);
//Color Rectangle at top
doc.setFillColor(51, 204, 255);
doc.rect(0, 0, 1700, 50 , 'F');
//Congrat Text
doc.setFontSize(36);
doc.setFont("helvetica");
doc.setFontStyle("bold");
doc.setTextColor(255, 255, 255);
doc.text(105, 30, "Wrap-up note");
//Notes Heading
doc.setFontStyle("normal");
doc.setFontSize(12);
doc.setTextColor(0, 0, 0);
doc.setFontStyle("normal");
doc.text(20, 65, "Note 1:");
//User Name
doc.setFontSize(14);
doc.setFontStyle("normal");
doc.text(20,75, userName);
//Notes Heading
doc.setFontStyle("normal");
doc.setFontSize(12);
doc.setTextColor(0, 0, 0);
doc.setFontStyle("normal");
doc.text(20, 110, "Note 2:");
//Notes Variable Information
doc.setFontSize(14);
doc.setFontStyle("normal");
doc.text(20, 120, splitNotes);
//Save PDF
doc.save('Wrap-up note');