Forum Discussion
Storyline 2 Example - Generating a PDF Certificate for users who successfully complete a quiz
Hi Kevin,
As I mentioned in my previous post images must be converted to base64 strings and included as data uri's. You don't need to use an online converter, you can do this locally. I'm not going to go into how to do this, a quick google should point you in the right direction.
The following example demonstrates how you can use filenames when using pdfmake with NodeJS locally / on a server.
// under NodeJS (or in case you use virtual file system provided by pdfmake)
// you can also pass file names here
image: 'myImageDictionary/image1.jpg'
There's no way to directly import a PDF, it would need to be converted to an image.
Unfortunately pdfmake doesn't support vector based images.
If you want to do something more advanced I think you'll have to do it server side. We use TCPDF to generate certificate PDF's server side with PHP in our VLE. This PHP class is much more advanced than pdfmake and the other javascript pdf libraries. Another benefit of generating server side is that you can keep a record of all issued certificate pdfs,
Cheers,
Ryan
Thank you Ryan.
All the best,
Kevin