Forum Discussion
Example files: Generating a certificate from Storyline
I also gave a couple of frameworks a spin. I tried FPDF, mPDF, and jsPDF.
The nice thing about jsPDF is it's all done client-side, but if you want HTML5 compatibility without flash, browser support is woeful. They require a flash shim to be able to view/download the pdf for older browsers. This obviously won't work on many iOS devices.
I then had the same idea as you Steve about using URL params to auto-fill an existing PDF form. The problem with this approach that I found was that with the most recent version of Adobe Reader, it will flag documents coming from a different domain as unsafe and will require the end user to allow them to trust the pdf. It will also flag older PDFs with JS inside as unsafe. However, once trusted, the JS inside the PDF will be able to pull in the URL params and do the magic. I didn't want my end users to have to go through that trust process because many of them are afraid of security dialogs.
Then I thought about a server-side solution that would auto-fill a PDF form and many of those solutions required you to create an "acroform" that was version 1.4 or below... and had to be created using a special tool or the full version of Adobe Acrobat Pro (or LiveCycle Designer). Not too many IDs or Content Developers have the full version of Adobe Acrobat or LiveCycle.
So I thought I'd do pure server-side PDF generation using URL parameters passed from a course.
FPDF is a great PHP library for generating server-side certificates and worked well in my tests. But something else caught my eye. mPDF is a derivative of FPDF that will also allow you to convert HTML tags to PDF... with CSS support. This means that if you need to make changes to the certificate (even the background image), all you have to do is edit a simple css file and you're DONE!
Here's the CSS file:
@page { background-image: url("./molcertificate_96dpi.jpg"); background-repeat: no-repeat; background-position: center center; } body{ text-align: center; font-family:Arial, Helvetica, sans-serif; font-size: 22; } #title{ font-size: 44; font-weight: bold; margin-bottom: 50px; padding-top: 2em; } #name{ text-decoration: underline; font-size: 30; font-weight: bold; margin-bottom: 50px; } #hascompleted{ margin-bottom: 50px; } #course{ font-size: 30; font-weight: bold; margin-bottom: 50px; } #date{ }
I'm really loving mPDF because it also supports UTF-8 allowing for PDFs generated in any language.
If you're running PHP, I found this to be the best solution.
Granted a pure client-side solution would be THE ideal, but I found browser support and PDF security to be an issue.