Customize Certificates

Course Builder allows you to include a certificate of completion with your course which is presented to students after they pass the criteria.

If you would like to customize the certificate, you can supply your own background image or change the default text.

Change the background image

The background image used for both the HTML and PDF versions is here:

coursebuilder/modules/certificate/resources/images/cert.png

You can overwrite this file with your own image. Just make sure you scale the image to be the same size as the default image.

Your image can be a a PNG, JPG, or GIF, but must be named cert.png. If you’d like to give the file a different name (including extension), you must go into .../coursebuilder/modules/certificate/certificate.py and change references to cert.png to match new filename.

Change the certificate text

For simple wording changes, you can update the text in the HTML and PDF versions as follows.

  • HTML text
    • Located here: .../coursebuilder/modules/certificate/templates/certificate.html
    • Search for gettext('.....').
    • Replace the contents with your own text.
  • PDF text
    • Located here: .../coursebuilder/modules/certificate/certificate.py.
    • Search for def _print_cert(....
    • In this function, there are several calls you can edit:
      • text.setTextOrigin(0.5 * inch, 4.0 * inch): This sets the position of the text, where (0,0) is bottom left.
      • text.setFillColorRGB(0.4, 0.4, 0.4): Sets the color of the printed text in RGB
      • text.setFont('Helvetica', 20): Sets text font and size.
      • text.textLine(self.gettext('Presented to')): Sets the actual text that will be added with the selected location, color, font, size.

Note: In Python, leading whitespace is crucially important. Tabs are not the same as spaces and many editors will replace spaces with tabs in a potentially non-obvious way. Be careful of this if you edit certificate.py.

For anything other than very basic changes, you may also need to update the CSS of the certificate, which you can find here:

.../coursebuilder/modules/certificate/resources/css/certificate.css

If you’re not familiar with CSS, there are many resources on the Internet that can provide assistance.