Here is an example of how to use PDFKit to design an "ADCA" certificate with a name, photo, signature place, and a head signature:
![]() |
Here is an example of how to use PDFKit to design an "ADCA" certificate. |
const PDFDocument = require('pdfkit');
const fs = require('fs');
// Create a new PDF document
const doc = new PDFDocument();
// Set the font and font size
doc.registerFont('OpenSans', './fonts/OpenSans-Regular.ttf')
doc.registerFont('OpenSansBold', './fonts/OpenSans-Bold.ttf')
doc.font('OpenSansBold')
.fontSize(20)
.text("ADCA", {align: 'center'});
// Add some text
doc.font('OpenSans')
.fontSize(14)
.text("This certificate is awarded to", {align: 'center'});
doc.font('OpenSansBold')
.fontSize(16)
.text("Brijesh Kumar", {align: 'center'});
doc.moveDown();
doc.moveDown();
// Add image
doc.image('./images/dummy-photo.jpg',{
fit: [100, 100],
align: 'center',
valign: 'center'
});
// Add signature place
doc.moveDown();
doc.moveDown();
doc.text("Signature: ____________________________", {align: 'center'});
// Add head signature
doc