Certificate template

A landscape page in a fixed region with shapes, a QR code and centred text.

A rendered certificate of completion with a double border, a recipient name, a QR code and a signature line

What it demonstrates

  • A fixed region with absolutely positioned frames
  • Rectangle and line shapes for borders and rules
  • A QR code built with concat from a verification URL and an identifier
  • Landscape A4 with zero margins

Rendered with the screen target. In print and PDF output page numbers show the real total and long tables continue onto further pages. See pagination.

Use it

render.ts
import { renderDocument } from 'docstudio';
import template from './template.json' with { type: 'json' };
import data from './data.json' with { type: 'json' };

const result = renderDocument(template, data, { target: 'print' });
if (!result.ok) {
  throw new Error(result.diagnostics.map((item) => item.message).join('; '));
}
const html = result.html;

Get the files

Copy the template and the sample data as JSON, save them as template.json and data.json, and use the snippet above to render them.