Customizing Certificate Using PDF

While you can create a custom certificate using the scripting example mentioned here, it may be difficult for many users who are not developers. This article describes another way to add custom certificate in your site.

Video

 

 

Step1: Create a certificate design including background, static text, any logo etc in Powerpoint (you can use MS word also)

Step2: Open Adove Acrobat Professional, and select Create PDF, then select the PPT you have created in the previous step. Note that you can use any other editor to insert Form Fields in the PDF. There are many online tools available which let you upload a file and insert fields in it.

 

Step3: Click on Create Form in the Designer tool, and follow couple of dialogs to load the form editor

 

Step4: Add text fields using the Form editor, at appropriate positions in the template. Name these fields using the supported field names (mentioned at the end of this page). Some common fields used in this example are courseSession.name, student.fullName, grade.points, grade.awardDate

 

Step5: Save the PDF template

Step6: Open the microsite, and go to CMS. Click on create new certificate template

Step7: Enter name for the template, and end it with .pdf, for example myTemplate.pdf. This will be just a wrapper for the PDF we just created before. Add some comment in the content (content is mandatory) using double forward slashes // and Save Draft

Step8: Drag and drop the PDF (as you drag the file, the color of droppable region will change to indicate whether it is the right place to drop the file or not. Click upload. Use Firefox or Chrome for this step as Internet Explorer doesn't yet support file drag drop.

Step9: Publish the template, and Open the template again from CMS browser to make sure you can see uploaded PDF as an attachment

Step10: Edit any course and link this template

 

 Predefined Field Names for course session certificate

Student's attributes

Field Name Description
student.firstName First name, e.g. John
student.lastName Last name, e.g. Doe
student.userName login id, e.g. jdoe
student.fullName First Name Last Name joined, e.g. John Doe

 

Course Attributes

Field Name Description
course.name name of the course
course.code code of the course
course.author Presentor/Author of the course
course.description course description
courseSession.name name of course session
courseSession.code code of course session
courseSession.description description of course session
courseSession.startDate start date of course session
courseSession.endDate end date of course session
courseSession.groupName course session's parent group name
instructor.fullName course Presentor/Author name

Grade attributes

Field Name Description
grade.points points obtained, for percent grading schemes, this will be percent value, for point schemes this will be absolute points
grade.grade grade label, for grading scheme with Label display type (e.g. A, A+ B ...)
grade.credits If the course session is used in program then this will contain credit for the course in the program which student earned when they completed the course
grade.awardDate Date when course session was completed successfully by the student

 

 Predefined Field Names for program certificate

 

Student's attributes

Same as previous section for course session specific field names

Program attributes

Field Name Description
program.name Name of the program
program.code Code of the program
program.description Description of the program
program.totalCredits Total credits available in the program

 

Program Member's attributes

Field Name Description
member.startDate Student's joining date in the program
member.completionDate Student's completion date
member.credits Credits earned by the students

 

Scripting for formatting fields and custom variables:

For advanced calculation of field variables (override the default) or to create custom variables, you can use Velocity Scripting inside the certificate template code. This can be used for example to change formatting of fields like Dates, or convert default value like converting student's name to uppercase, or add a new field name which can be used in the PDF 

Examples:

Changing Award Date format -

//Convert award date format to print only month and year
$OUT.put("grade.awardDate", $DateFormatter.getFormattedDate($grade.getAwardDate(), "MMM yyyy"));

//Convert award date format to print mm/dd/yyyy format

$OUT.put("grade.awardDate", $DateFormatter.getFormattedDate($grade.getAwardDate(), "MM/dd/yyyy"));

//Convert award date format to print date with full month name - like 15 August 2015

$OUT.put("grade.awardDate", $DateFormatter.getFormattedDate($grade.getAwardDate(), "dd MMMM yyyy"));

//Convert course session name to uppercase

$OUT.put("courseSession.name", $courseSession.getName().toUpperCase());

//Print first and last name (if at site level, you have configured lastName, firstName ordering and want to reverse it in certificate)

$OUT.put("student.fullName", $OUT.get('student.firstName').concat(" ").concat($OUT.get('student.lastName')))

//Convert points to always display 2 decimal digits (e.g. 73.00 instead of 73)
$OUT.put("grade.points", $Utility.format($grade.getPoints(),2,2).concat("%"));

//Add a new variable, to print name of the group where course session belongs

$OUT.put("myInstitute", $courseSession.getGroup().getName());

//Add course's metadata via a custom field (metadata are not populated by default in any predefined fields)

$OUT.put("subject", $course.getMetadataSubjects());

$OUT.put("subject", $course.getMetadataExams());

$OUT.put("subject", $course.getMetadataRegions());

$OUT.put("subject", $course.getMetadataSkillLevels());

$OUT.put("subject", $course.getMetadataComplexities());

// calculating a certificate expiry date using course completion date - say certificate expire after 6 months of completion date. add placing that expiry date in a variable expiryDate that can be used in pdf form.

#set ($exp_date = $DateUtils.addMonths($grade.getAwardDate(),6));
$OUT.put("expiryDate", $DateFormatter.getFormattedDate($exp_date, "dd MMM yyyy"));

// calculating duration using course credits and specifying in certificate. (Please note convert int/float to string before assigning in form variable).

#set($s = 10 * $course.getCredits());
#set($hours = $s.toString($s));
$OUT.put("course.duration", $hours)

Scripting for selecting certificate attached pdf

In a certificate template multiple pdf template can be uploaded. By default system picks the latest pdf file for generating the certificate. 

A script can be added to pick a specific pdf based on certain condition. In below example pdf is selected based on user's custom property 'profession' value. 

#set($prof = ${student.getProperty("Profession").trim()})
#if ($prof == "Doctor")
     $OUT.put("certTemplateName", "Certificate1.pdf");
#elseif ($prof == "Nurse")
     $OUT.put("certTemplateName", "Certificate2.pdf");
#elseif ($prof == "Physical Therapist")
     $OUT.put("certTemplateName", "Certificate3.pdf")
#else
     $OUT.put("certTemplateName", "Certificate3.pdf");
#end

Script to select a specific certificate pdf for completions after a given date -

#set($dateToCheck=$DateFormatter.parse('02/14/2021','MM/dd/yyyy'))

#if($member.getCompletionDate().getTime() > $dateToCheck.getTime())

$OUT.put("certTemplateName", "Certificate-new.pdf");

#else

$OUT.put("certTemplateName", "Certificate-old.pdf");

#end

Set a custom certificate as default certificate for the site

A custom certificate can be set as site's default certificate, Please follow these steps for that

  • Access CMS list page and search for Type as Certificate Template, If custom certificates are created in the site those will be listed.

  • Click name link of any certificate that you want to set as site's default certificate. Click the down-arrow button present next to Edit.

  • You will find options 'Default Course Session certificate' and 'Default Program Certificate'.
  • click the option 'Default Course Session certificate' if you want to set this certificate as default course certificate.
  • Once certificate is set as default certificate, You will notice a tick mark next to Default Course session certificate option

           Same way default program certificate can be set.

 

 


Rating: