Blueprint#
A blueprint is a JSON document that places elements on the page of a certificate template.
The normative definition is the JSON Schema in backend/src/collective/certificates/blueprint/schema.json, also shipped as packages/volto-certificates/src/blueprint/schema.json in the frontend.
Both copies are byte-identical.
The schema defines no default values. Where a property is optional, the last column says what happens when it is absent.
Document#
Property |
Type |
Constraints |
Default |
|---|---|---|---|
|
integer |
Required. Must be |
None; required |
|
object |
Required. See page. |
None; required |
|
array |
Required. At most 100 items, each an element. Drawn in order, so later elements are on top. |
None; required |
No other top-level property is allowed.
A new template starts with the page size of an A4 landscape sheet at 300 dpi, 3508 by 2480, and no elements.
Page#
Property |
Type |
Constraints |
Default |
|---|---|---|---|
|
integer |
Required. From 1 to 20000 pixels. |
None; required |
|
integer |
Required. From 1 to 20000 pixels. |
None; required |
The page size equals the pixel size of the background image. Saving a template with a new background resets the page to match it, and element positions are left alone.
Elements#
Every element has an id, a type, and the properties of its type.
Ids are unique within a blueprint.
Property |
Type |
Constraints |
Default |
|---|---|---|---|
|
string |
Required. Matches |
None; required |
|
string |
Required. One of |
None; required |
Text elements#
A text element draws one line of text.
Its (x, y) is the anchor point, so anchor and baseline decide where the text sits around it.
Property |
Type |
Constraints |
Default |
|---|---|---|---|
|
string |
Required. See elements. |
None; required |
|
string |
Required. Must be |
None; required |
|
integer |
Required. From 0 to 20000. |
None; required |
|
integer |
Required. From 0 to 20000. |
None; required |
|
string |
Required. |
None; required |
|
string |
Required. |
None; required |
|
string |
Required. A font token, matching |
None; required |
|
integer |
Required. Font size in page pixels, from 1 to 2000. |
None; required |
|
string |
Required. |
None; required |
|
string |
Required. From 1 to 500 characters. May hold placeholders. |
None; required |
|
integer |
Optional. From 1 to 20000 pixels. |
Not set: no width limit |
|
string |
Optional. |
Not set: behaves as |
|
integer |
Optional. Must be |
Not set |
With fit set to shrink and max_width set, the size is lowered until the rendered text is at most max_width wide.
The size never goes above size.
Without max_width, shrink changes nothing.
Image elements#
An image element draws one of the template's images, fitted inside its box: the background, or an Image item inside the template.
Property |
Type |
Constraints |
Default |
|---|---|---|---|
|
string |
Required. See elements. |
None; required |
|
string |
Required. Must be |
None; required |
|
integer |
Required. From 0 to 20000. |
None; required |
|
integer |
Required. From 0 to 20000. |
None; required |
|
integer |
Required. From 1 to 20000 pixels. |
None; required |
|
integer |
Required. From 1 to 20000 pixels. |
None; required |
|
string |
Required. |
None; required |
|
integer |
Optional. Must be |
Not set |
The image is drawn with preserveAspectRatio="xMidYMid meet", so it keeps its proportions inside the box.
An image element whose asset names no image is not drawn when rendering.
Validation reports it as an error ("the template has no ... image") when the template is checked against its images: by the designer's Apply, @validate-blueprint, @preview, @render and @create-certificate.
Saving the template checks only background, because a template is saved before anything can be added inside it.
QR code elements#
A QR code element draws a square QR code that encodes its content after placeholders are filled in.
Property |
Type |
Constraints |
Default |
|---|---|---|---|
|
string |
Required. See elements. |
None; required |
|
string |
Required. Must be |
None; required |
|
integer |
Required. From 0 to 20000. |
None; required |
|
integer |
Required. From 0 to 20000. |
None; required |
|
integer |
Required. Side of the square, from 1 to 20000 pixels. |
None; required |
|
string |
Required. From 1 to 500 characters. May hold placeholders. |
None; required |
|
string |
Required. Error correction: |
None; required |
|
string |
Required. Dark modules, as a |
None; required |
|
string |
Required. Background of the square, as a |
None; required |
|
integer |
Optional. Must be |
Not set |
The encoder uses byte mode in UTF-8 and keeps the requested error correction level, without raising it when a larger symbol would fit.
Rotation#
rotation appears in the schema on every element, but only 0 is valid.
Version 1 does not support rotation.