Table of Contents

Purpose

Provide the authors of certifications to upload a certificate template which will be awarded to learners on successfull completion of a certification.

Mantis issues for this feature: 0004418, 0004419, 0004421

Implementation details

Tables

certificate_templates
id
certification_id
template_file_name
template_content_type
template_file_size
template_updated_at
created_at
updated_at
certificates
id
enrollment_id
certificate_file_name
certificate_content_type
certificate_file_size
certificate_updated_at
created_at
updated_at

New paper clip processer that will generate png images of the template/actual certificate pdf. The png images of following size will be generated

  1. 365×275 - for Preview
  2. 73×56 - for thumbnail

A record in certificates table will be created when user passes a certification. Since a certification can be attempted multiple times more then certificate can be generated for an enrollment however we will show only the latest one in the UI (later on we can have a screen where the user can view all the successful attempts along with its certificate and choose which one to show in UI).

Certificate creation/generation

There are 2 approaches that can be taken to implement the certificate creation/generation.

1) Direct upload of pdf template

User can directly upload a pdf template (which is created outside our application i.e. via Adobe acrobat (Professional) or any other similar tool e.g. http://www.pdfescape.com (which allow to create form filled pdfs for free). Again when creating the pdf template the user should honor the naming of placeholder fields based on the instructions provided by us.

The owner can then upload template pdf file when creating the certification and when a learner completes a certification we can generate a prefilled pdf from the template with the actual data embedded into it. This prefilling can be done via XFDF (XML Forms Data Format) [http://partners.adobe.com/public/developer/en/xml/xfdf_2.0.pdf] using a command line tool called PDFtk (http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/).

This blog (http://bleep.lapcominc.com/2012/02/07/filling-pdf-forms-with-ruby-and-pdftk/) gives good information on how it can be integrated with ruby.

The advantage of using this approach is that user as complete control and flexibility to create any kind of certificate template. However this also means that the user should should know how to create pdf templates.

2) Create template using tool provided by learnexa

Here we provide a tool(UI) which the owner can use to create templates of his choice (using WYSIWYG editor - tinymce) and in between the template he can insert some predefined placeholders which will finally be replaced with the actual data.

To generate the actual pdf certificate we will use the Html template that was created using the “Certificate template creator” and replace the placeholders with actual data.

For now we will go with approach 1 of direct upload of pdf template. The onus is on the user to generate a valid PDF template in which the placeholder fields are properly named as per the instructions provided by Learnexa.

Placeholder naming rules

Currently we will support 3 dynamic placeholders in the pdf template

First name - Will display the first name of the learner. In the pdf template the name of the placeholder for this field should be 'firstname'.

Last Name - Will display the last name of the learner. In the pdf template the name of the placeholder for this field will be 'lastname'.

Completion Date - Will display the Date when the certificate was issued. In the pdf template the name of the placeholder for this field will be 'completion_date'.

Workflow

  1. create a PDF template using any PDF editor
  2. add placeholder variables(form fields) in the appropriate positions in the PDF template document. You need to have at least one of these form fields: firstname, lastname, completion_date
  3. upload this template when creating a certification(in the certification property sheet)

Installing Pdftk

pdftk will be used to fill the pdf template with appropriate data. Below are installation instructions.

For ubuntu

apt-get install pdftk

For centos

yum install pdftk