Forum Discussion
Example files: Generating a certificate from Storyline
This example demonstrates how you can take user input and generate a certificate for printing. Any Storyline variable or score can be used to generate the output. The file and file add-ins are both simple and straight forward. This will only work in the Flash based output. This will not work in the iOS output or HTML5.
To replicate this on your end:
1) Modify the story file to your liking.
2) Extract the add-in zip file above (certificate.html and certificateBG.gif)
3) Copy these two files into your published output directory. You'll need to do this each time you publish.
This is a really basic example. You really can do quite a bit with this including adding a print button, extra fields, collecting values from the LMS like the user's first and last name.
** I noticed a bug when playing with this file setup. I initially thought I would be able to include the certificate files as resources to avoid copy / paste surgery after publish. Unfortunately, Storyline mangled the HTML file on publish. Will be submitting this as a bug.
- JeffreyHurtCommunity Member
Has anyone come up with a solution that can work for both HTML5 and Flash-version courses? I'd be willing to include a solution for each if there is a way to do so.
I have uploaded an abbreviated version of what I've been asked to do. I need the certificate to print just as it appears in the second slide. Is there a way to have a single slide appear without any player information so it is simply what is on the "stage"?
Steve's example is great, but the fact it goes haywire in HTML5 is concerning as we are developing this course for users all over the globe and the HTML5.
Thanks in advance!
- JanisTournil472Community Member
That looks great, but how do you print it?
- MaryBakerCommunity Member
Jeffrey,
I have the same question about printing only what is on stage and not the logo or sound icon. I figured out how to disable the menu but can't figure out the rest. Did you come up with a solution?
Thanks :)
- LeslieAdamsCommunity Member
Hi - I'm wondering if anyone knows how to get the certificate to print in landscape orientation by default (without the user having to change the print preferences). My understanding is that this would be a setting in the html document, but not quite sure how to set it up.
- OwenHoltSuper Hero
I keep it simple. when my storyline file opens, I get the date. It is the first thing the first slide does. This lets me display the date throughout the course. Here is the code I use.
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd='0'+dd
}
if(mm<10) {
mm='0'+mm
}
today = mm+'/'+dd+'/'+yyyy;
var player = GetPlayer();
player.SetVar("SystemDate",today);
The certificate java is at the end of the course. Keeping them separate makes it easier to trouble shoot.
My certificate java looks like this:
myWindow = window.open("","Print","width=900,height=700,scrollbars=0,resizable=0");
var player=GetPlayer();
var course=player.GetVar("CourseName");
var username=player.GetVar("NewName");
var date=player.GetVar("SystemDate");
var score=player.GetVar("ScorePercent");
var contents ='<html></head><style type="text/css">';
contents+='h2 {font-family:"Museo Sans For Dell"; font-size:20px; color:#333333}';
contents+='h3 {font-family:"Museo Sans For Dell"; font-size:30px; color:#0085C3}';
contents+='h4 {font-family:"Museo Sans For Dell"; font-size:16px; vertical-align:bottom}';
contents+='</style><body>';
contents+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
contents+='<tr><td><center><img src="../GFPA0104/certificate/CertificateBanner.png"></center></td></tr></table>';
contents+='<table width="100%" border="0" cellspacing="0" cellpadding="20">';
contents+='<tr><td colspan="5"><center><h2>THE GLOBAL FP&A L&D TEAM CERTIFIES THAT</h2>';
contents+='<h3>'+username+'</h3>';
contents+='<h2>HAS SUCCESSFULLY COMPLETED</h2>';
contents+='<h3>'+course+'</h3>';
contents+='<h2>WITH A SCORE OF</h2>';
contents+='<h3>'+score+'%</h3></center></td></tr></table>';
contents+='<table width="100%" border="0" cellspacing="0"><tr>';
contents+='<td width="30%"><center><img src="../GFPA0104/certificate/Signature.png"></center></td>';
contents+='<td width="5%" rowspan="2"></td>';
contents+='<td width="30%"><center><h4>'+date+'</h4></center></td>';
contents+='<td width="15%" rowspan="2"></td>';
contents+='<td width="20%" rowspan="2"><img src="../GFPA0104/certificate/Dell-Logo.png"></td></tr>';
contents+='<tr><td><center><img src="../GFPA0104/certificate/Signature Line.png"></center></td>';
contents+='<td><center><img src="../GFPA0104/certificate/Date Line.png"></center></td></tr></table>';
contents+='</body></html>';
myWindow.document.write(contents);
myWindow.document.close();
myWindow.focus();
myWindow.print();
- christinejeziorCommunity Member
Whilst I was able to generate the certificate ...it always was blank without the results... went crazy trying to work out java code... the reason for buying articulate is I don't want to do coding I don't have an IT background...... but then just as I was drifting off to sleep.... it came to me and it was easy... I used variables and just changed the results screen into a certificate.. with voice over right click and print... easy and works great for me... low tech I know but it was exactly what I wanted... Happy to do a screener if anyone needs it...
- AndrewSellonCommunity Member
After reading through this lengthy thread, I just submitted a feature request. Here's what I said:
Hi there! I have a new client who needs me to provide a traditional certificate (filigreed border and all) at the end of a course, pulling data for name, date, course title, and test score. In a foreign language. And it needs to be printable. I looked in Storyline, and then in the forum, and was amazed to find you folks still don't provide a ready-to-use Results slide in the form of a customizable, printable certificate template within the Articulate 360 suite. As you know, this is a feature Adobe Captivate has offered for a few years now. I watched your old video about revising the Report.html file. That's too much work for many of your customers, who may not have the basic code-tweaking skills needed. And having to manually place the file in the appropriate folder after publish? A recipe for mistakes to be made. I read that your reasoning is you consider proof of completion to be the province of a company's LMS. But as you've acknowledged, there are companies who don't use an LMS, or still want a traditional certificate the learner can print out at the end of the course, within the course, even if the company does use an LMS. As you know from the attached forum thread, people have been asking you for this feature for at least six years, and continue to ask for it currently. Isn't this something that would be a really huge WIN for you folks to produce? Couldn't you create a good-looking template with editable certificate title (for foreign language clients), and learner name, date, score, and course title variable fields, include the coding to make it easily printable, and make that available to all your users as a Results slide option? All the course creator should need to do is conform their variable titles to those you use (or, you make them editable). I do hope you will at last revisit and reconsider your position on this ongoing basic need. It would be hugely appreciated by many of your customers. Thanks!
- MarkFletcher1Community Member
Great example Steve! So if you are 'Iron Man' does that mean that Phil is 'Thor' and Russ 'Captain America'?
- PhilMayorSuper Hero
Thor is good
- MarkFletcher1Community Member
I thought that you would like that
Best regards,
Mark
- RussStillCommunity Member
I always wanted to be a Captain of something.
- NancyWoinoskiSuper Hero
Hi Daniel - Storyline has one source file this is the .story file but when you publish your course, a folder is created in Documents/My Articulate Projects folder the has the same name as the title of your course. This is the published output directory that Steve is referring too. This output directory contains all the folders and files that the course needs in order to run.
If you look in the folder you will see story.swf, story.html files, a story_content folder and a mobile folder among others.
Steve created a special html page called certificate.html that is not a native part of Storyline so when you publish Storyline it does not get included in the published directory automatically. You have to save a copy of it and then place it in the published folder after you have published your course (same is true of the CertificateBG.gig that he is using in the certificate.html page).
In the sample .story file that Steve created, he put some JavaScript on a button ( I think the button is called Generate Report ) that basically says open this certificate.html page and make it a fixed size) when the user clicks the button. You will have to include this JavaScript on a button in your course if you want to use the certificate.html file.
The certificate.html page contains JavaScript code that says to get a variable called learner from storyline and display it in certificate.html. The variable "learner" is just a text entry field in the .storyline file. When you add a text entry field to a screen in Storyline, it is given a default variable name, TextEntry, TextEntry1, TextEntry2 etc so that each one has a unique name.
You can change the name of these default variable names to give them more meaningful names - that is what Steve did in his example. In his .story file, he changed the name of Text Entry field to learner.
So in your course, you need to add a text entry field where the user can enter his or her name. This will have a default name like I just mentioned. So now you have 2 options, you change the variable name of the text entry field you created to learner, or you can edit the certificate.html file (using notepad like Dave suggests) and change the learner to TextEntry or whatever the default name is for the text entry field you created.
Sorry, this is a little long winded but I hope it helps.