Use Case

Certificate Generation
HTML Templates to PDF Certificates via API

Design beautiful certificate templates in HTML/CSS — custom fonts, logos, gradients, gold borders. Send them to SnapRender's PDF endpoint with recipient details and get a print-ready PDF back. Perfect for online courses, events, and training programs.

The problem

PDF libraries can't handle real designs

Traditional PDF libraries (ReportLab, jsPDF, PDFKit) force you to position elements with coordinates and draw shapes with code. Want a gradient background? Custom font? Centered text in a decorative border? That's hours of manual layout programming for a single template.

With SnapRender, you design your certificate in HTML/CSS — the same tools you already know. Flexbox, Google Fonts, gradients, borders, images — it all just works. Send the HTML to the /pdf endpoint and get a perfect PDF back in seconds.

How it works

Three steps to PDF certificates

1

Design your certificate in HTML/CSS

Create a beautiful certificate template with your branding — custom fonts, logos, decorative borders, gradients. Use any CSS you want. Test it in a browser until it looks perfect.

2

Inject recipient data and call the API

For each recipient, populate the template with their name, course, date, and certificate ID. POST the HTML to /v1/pdf with landscape: true and print_background: true.

3

Distribute the PDF

Email the PDF directly to the recipient, make it downloadable from your LMS, or store it for verification. Each certificate is a standalone, print-ready PDF file.

Code examples

Generate certificates in any language

Python
import requests

API = 'https://api.snaprender.dev/v1/pdf'
HEADERS = {'Authorization': 'Bearer YOUR_KEY'}

def generate_certificate(name, course, date):
    html = f"""
    <html>
    <head>
      <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Inter&display=swap" rel="stylesheet">
      <style>
        @page {{ size: A4 landscape; margin: 0; }}
        body {{
          margin: 0; width: 297mm; height: 210mm;
          display: flex; align-items: center;
          justify-content: center;
          background: linear-gradient(135deg, #1a1a2e, #16213e);
          font-family: 'Inter', sans-serif; color: white;
        }}
        .cert {{
          border: 3px solid gold; padding: 60px;
          text-align: center; width: 80%;
        }}
        h1 {{ font-family: 'Playfair Display'; font-size: 36px;
             color: gold; margin: 0 0 10px; }}
        .name {{ font-size: 48px; font-weight: 700;
                 margin: 30px 0; }}
        .course {{ font-size: 20px; opacity: 0.8; }}
        .date {{ font-size: 14px; opacity: 0.6;
                 margin-top: 40px; }}
      </style>
    </head>
    <body>
      <div class="cert">
        <h1>Certificate of Completion</h1>
        <p class="course">This certifies that</p>
        <p class="name">{name}</p>
        <p class="course">has completed {course}</p>
        <p class="date">{date}</p>
      </div>
    </body>
    </html>
    """

    resp = requests.post(API, headers=HEADERS, json={
        'html': html,
        'format': 'A4',
        'landscape': True,
        'print_background': True
    })

    filename = f'{name.replace(" ", "_")}_cert.pdf'
    with open(filename, 'wb') as f:
        f.write(resp.content)
    return filename

# Generate for all participants
participants = [
    ('Alice Johnson', 'Advanced Python', 'April 12, 2026'),
    ('Bob Smith', 'Advanced Python', 'April 12, 2026'),
]
for name, course, date in participants:
    print(f'Generated: {generate_certificate(name, course, date)}')
Node.js
const fs = require('fs');

const API = 'https://api.snaprender.dev/v1/pdf';
const HEADERS = {
  'Authorization': 'Bearer YOUR_KEY',
  'Content-Type': 'application/json'
};

async function generateCert(name, course, date) {
  const html = `
  <html>
  <head>
    <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Inter&display=swap" rel="stylesheet">
    <style>
      @page { size: A4 landscape; margin: 0; }
      body {
        margin: 0; width: 297mm; height: 210mm;
        display: flex; align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #1a1a2e, #16213e);
        font-family: 'Inter', sans-serif; color: white;
      }
      .cert { border: 3px solid gold; padding: 60px;
              text-align: center; width: 80%; }
      h1 { font-family: 'Playfair Display'; font-size: 36px;
           color: gold; }
      .name { font-size: 48px; font-weight: 700;
              margin: 30px 0; }
    </style>
  </head>
  <body>
    <div class="cert">
      <h1>Certificate of Completion</h1>
      <p>${name}</p>
      <p class="name">${course}</p>
      <p>${date}</p>
    </div>
  </body>
  </html>`;

  const res = await fetch(API, {
    method: 'POST', headers: HEADERS,
    body: JSON.stringify({
      html, format: 'A4',
      landscape: true, print_background: true
    })
  });

  const filename = `${name.replace(/ /g, '_')}_cert.pdf`;
  fs.writeFileSync(filename,
    Buffer.from(await res.arrayBuffer()));
  return filename;
}

// Batch generate
const participants = [
  ['Alice Johnson', 'Advanced Python', 'April 12, 2026'],
  ['Bob Smith', 'Advanced Python', 'April 12, 2026'],
];
for (const [name, course, date] of participants) {
  console.log(`Generated: ${await generateCert(name, course, date)}`);
}
Applications

Who generates certificates?

Online courses & LMS

Automatically generate completion certificates when students finish a course. Integrate with your learning management system via API.

Events & conferences

Issue attendance certificates, speaker certificates, and achievement awards. Generate hundreds of personalized PDFs in minutes.

Training & compliance

Corporate training programs need verifiable certificates. Generate them with unique IDs, QR codes, and official branding.

Awards & recognition

Employee recognition programs, competition awards, volunteer acknowledgments. Beautiful PDFs that people are proud to display.

Simple pricing for certificates

Each PDF certificate counts as one request. No per-page charges, no resolution fees.

$0
100 certs/mo
$9
1,500 certs/mo
$29
5,000 certs/mo
Start Free

Frequently asked questions

You design an HTML/CSS certificate template with placeholders for the recipient name, course title, date, etc. Send the populated HTML to SnapRender's /pdf endpoint, and it returns a beautifully formatted PDF certificate — ready to email or download.

Yes. Your HTML template supports any CSS, web fonts (Google Fonts, Adobe Fonts, or inline @font-face), images, SVG logos, gradients, borders, and complex layouts. The certificate looks exactly like your design.

SnapRender supports A4, Letter, Legal, and custom page dimensions. For certificates, landscape A4 (297x210mm) is the most common format. Set orientation via the landscape parameter.

Yes. Loop through your list of recipients and make one API call per certificate. At typical response times of 1-3 seconds, you can generate hundreds of certificates per hour. Use async/parallel requests for higher throughput.

Yes. SnapRender generates high-quality PDFs with print_background: true, preserving colors, gradients, and backgrounds. The output is suitable for both digital distribution and physical printing.

Each PDF certificate counts as one API request. The free tier includes 100 requests/month — enough for small courses. At $9/mo for 1,500 requests, you can run certification programs for hundreds of participants.

Beautiful certificates, zero layout code.

Design in HTML/CSS. Generate PDFs via API. Start free with 100 certificates/month.

Start Free — 100 requests/month