Use case
Certificate PDF API
Generate completion certificates, diplomas, and awards as pixel-perfect PDFs. Custom fonts, full bleed backgrounds, landscape layout — all via a single API call.
What makes certificates work
Google Fonts support
Reference any Google Font directly in your CSS @import. Chromium fetches and renders them. Use decorative serif fonts like Playfair Display for a premium look.
Full bleed backgrounds
Set margin to 0 and printBackground: true to render full-bleed background images, gradients, and colors. No white margins cutting off your design.
Landscape orientation
Traditional certificates are landscape A4 or letter. Set options.landscape: true — everything adjusts automatically.
Vector-quality output
CSS text and shapes are vector in the PDF. Logos embedded as SVG stay crisp at any print size. No blurry raster screenshots.
Generate a certificate
This example generates a dark-themed landscape certificate with a Google Font, gradient background, and gold typography — zero margin for a full-bleed result.
const html = `
<!DOCTYPE html>
<html>
<head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@400;500&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
width: 297mm; height: 210mm; /* A4 landscape */
display: flex; align-items: center; justify-content: center;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
font-family: 'Inter', sans-serif;
}
.certificate {
text-align: center; color: white;
border: 2px solid rgba(255,215,0,0.5);
padding: 50px 80px;
background: rgba(255,255,255,0.03);
}
.title { font-family: 'Playfair Display', serif; font-size: 48px; color: gold; margin-bottom: 8px; }
.subtitle { font-size: 16px; letter-spacing: 4px; text-transform: uppercase; opacity: 0.6; }
.recipient { font-family: 'Playfair Display', serif; font-style: italic; font-size: 36px; margin: 32px 0 16px; }
.course { font-size: 20px; font-weight: 500; margin-bottom: 32px; }
.date { font-size: 14px; opacity: 0.5; letter-spacing: 2px; }
</style>
</head>
<body>
<div class="certificate">
<div class="title">Certificate of Completion</div>
<div class="subtitle">This certifies that</div>
<div class="recipient">${name}</div>
<div class="course">has successfully completed · ${course}</div>
<div class="date">${date}</div>
</div>
</body>
</html>
`;
const response = await fetch("https://api.getpapyr.dev/v1/render/pdf", {
method: "POST",
headers: {
"Authorization": "Bearer pk_live_...",
"Content-Type": "application/json",
},
body: JSON.stringify({
html,
options: {
format: "A4",
landscape: true, // landscape for classic certificate shape
printBackground: true, // required for background gradients
margin: { top: "0", right: "0", bottom: "0", left: "0" }, // full bleed
},
}),
});
const pdf = await response.arrayBuffer();Certificate types
Course completion
Online learning platforms issuing certificates when a student finishes a course.
Professional certifications
Exam-based certifications with expiry dates and unique certificate IDs.
Employee awards
HR platforms generating employee-of-the-month or training completion certificates.
Event attendance
Conferences and workshops issuing attendance certificates to participants.
Diplomas
Coding bootcamps, trade schools, and online universities issuing diplomas.
Contest awards
Hackathons, competitions, and academic contests issuing winner certificates.
High-volume certificate generation
Generating certificates at the end of a course cohort? Papyr handles concurrent requests with a managed Chromium queue. The Pro plan supports 10,000 documents per month at $49/month — about $0.005 per certificate. For high-volume needs, the Scale plan covers 100,000 documents at $149/month.
Start generating certificate PDFs
100 free certificates per month. No credit card required.