PICTIFY
How to Create Certificates from HTML Templates
Programming

How to Create Certificates from HTML Templates

Suyash thakur
19 Jul
5 min read

Introduction

In this post, we’ll show you how to create a certificate image from HTML. This can be useful if you want to generate certificates for a large number of people, or if you want to automate the process of creating certificates for an online course or event.

Prerequisites

Before we get started, you’ll need to have the following tools installed on your computer:

Step 1: Create an Ejs template

The first step is to create an Ejs template for your certificate. Ejs is a simple templating language that allows you to embed JavaScript code in your HTML files. You can use Ejs to create dynamic certificates that include the recipient’s name, the date of completion, and other personalized information.

Here’s an example of a simple certificate template:

html

You can customize this template to include your own text, fonts, colors, and styles.

Step 2: Create a data file

Next, create a data file (e.g., data.json) that contains the recipient’s name and the date of completion. The data could be stored in a database or generated dynamically using a script. For this example, we’ll create a simple JSON file with the following content:

json

Step 3: Render the EJS template

To render the Ejs template with the data, we’ll use the ejs package. First, install the ejs package by running the following command in your terminal:

bash

Next, create a new JavaScript file (e.g., generateCertificate.js) and add the following code:

javascript

Step 3: Generate the certificate image

To generate the certificate image from the HTML template, we’ll use the Pictify API. Pictify is a simple API that allows you to convert HTML to images.

First, get your API key from the Pictify website{:targe:blank}. Then, install the axios package by running the following command in your terminal:

bash

Next, update the generateCertificate.js file with the following code:

javascript

Replace YOUR_API_KEY with your actual API key.

Finally, run the script by executing the following command in your terminal:

bash

The script will generate a URL which will be the certificate image. You can download the image by visiting the URL in your browser. The image for this example will look like this:

Certificate

Conclusion

In this post, we showed you how to create a certificate image from HTML using the Pictify API. This can be a useful tool for automating the process of generating certificates for online courses, events, or other purposes. If you have any questions or run into any issues, feel free to reach out to the Pictify support team for assistance.

Happy coding!

Free Tier Available

Render Your First Image
in Under 5 Minutes

Sign up, design a template, hit the API, and get a pixel-perfect PNG back. Free tier, no credit card.

View API Docs

Plans start at $39/mo after free tier

How long to integrate?

Most teams integrate in under 2 hours. One endpoint, JSON in, image out.

What about my data?

Your data is never stored. We render and return — that's it.

Can I cancel anytime?

Yes. No contracts, no commitments. Cancel with one click.

Instant Access
Get API Key immediately
50 Free Credits
No credit card required
Secure Infrastructure
Enterprise-ready security