You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: v1.7.0/setup/3.-installation/3.2-set-up-your-own-country-configuration/3.2.6-configure-certificate-templates.md
+54-12Lines changed: 54 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Once you have designed your certificate templates you are ready to configure the
7
7
8
8
### Step 1. Configuring certificate SVG files
9
9
10
-
The next step is for you to design and configure your certificate template [SVG](https://en.wikipedia.org/wiki/SVG) files. You can have as many different certificate as you like, represented as different [SVG](https://en.wikipedia.org/wiki/SVG) files, for each vital event. You use **\{{**[**handlebar**](https://handlebarsjs.com/)**\}}** syntax to mark where in the SVG you wish the citizen data to be rendered.  
10
+
The next step is for you to design and configure your certificate template [SVG](https://en.wikipedia.org/wiki/SVG) files. You can have as many different certificate as you like, represented as different [SVG](https://en.wikipedia.org/wiki/SVG) files, for each vital event. You use **\{{**[**handlebar**](https://handlebarsjs.com/)**\}}** syntax to mark where in the SVG you wish the citizen data to be rendered.  
11
11
12
12
All your SVGs should be placed in the [**src/api/certificates/source**](https://github.com/opencrvs/opencrvs-countryconfig/tree/develop/src/api/certificates/source) folder.
13
13
@@ -18,13 +18,13 @@ To get an idea of what we mean, take a look at the Farajaland example certificat
| Death | <p><ahref="https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/src/api/certificates/source/death-certificate-certified-copy.svg">Death Certificate</a></p><p><ahref="https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/src/api/certificates/source/death-certificate-certified-copy.svg">Death Certified Copy</a></p> |[Default death handlebars](https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/src/form/death/certficate-handlebars.ts)|
20
20
21
-
We have supplied helper handlebars for many use cases. Some need explanation, or if you feel that you do not have a handlebar for your specific needs, please discuss with us on [Github](https://github.com/opencrvs/opencrvs-core/discussions) or email us at [[email protected]](mailto:[email protected]) and we can work on a new handlebar for you. \
21
+
We have supplied helper handlebars for many use cases. Some need explanation, or if you feel that you do not have a handlebar for your specific needs, please discuss with us on [Github](https://github.com/opencrvs/opencrvs-core/discussions) or email us at [[email protected]](mailto:[email protected]) and we can work on a new handlebar for you. \
22
22
\
23
23
As an example of a handlebar that needs explanation: `{{placeOfBirth}}` is used if a user selects a pre-loaded [health facility](3.2.3-set-up-cr-offices-and-health-facilities/3.2.3.2-prepare-source-file-for-health-facilities.md). This handlebar dynamically returns the location hierarchy, e.g. "district, state" to render based on the location of the [health facility](3.2.3-set-up-cr-offices-and-health-facilities/3.2.3.2-prepare-source-file-for-health-facilities.md). You can see that in our place of birth location in the SVG, we have if/else logic to handle whatever the user chooses to enter into the form.
24
24
25
-
Sometimes you need to format the handlebars. For example to wrap text, or perform any number of manipulations. You can configure ["handlebar helper"](https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/src/form/common/certificate/handlebars/helpers.ts) functions to do this.
25
+
Sometimes you need to format the handlebars. For example to wrap text, or perform any number of manipulations. You can configure ["handlebar helper"](https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/src/form/common/certificate/handlebars/helpers.ts) functions to do this.
26
26
27
-
We have some configurable helper functions to get you started [here](https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/src/form/common/certificate/handlebars/helpers.ts). We also have some [built in](https://github.com/opencrvs/opencrvs-core/blob/cf1cb763abae7211fa3648a742d3763fd947eaa3/packages/client/src/views/PrintCertificate/PDFUtils.ts#L183) to opencrvs-core. Such as this one, giving you access to every property that exists in a FHIR Location.
27
+
We have some configurable helper functions to get you started [here](https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/src/form/common/certificate/handlebars/helpers.ts). We also have some [built in](https://github.com/opencrvs/opencrvs-core/blob/cf1cb763abae7211fa3648a742d3763fd947eaa3/packages/client/src/views/PrintCertificate/PDFUtils.ts#L183) to opencrvs-core. Such as this one, giving you access to every property that exists in a FHIR Location.
Watching the videos below will really help you understand how to configure the certificate. The time spent watching the video will make your life much easier!
42
+
Watching the videos below will really help you understand how to configure the certificate. The time spent watching the video will make your life much easier!
* The **event** property must be set to the supported `Event.<prop>` provided to you by TypeScript.
114
-
* The **label** property must be a [react-intl formatjs ](https://www.npmjs.com/package/react-intl)object with a translation for the visible label that you wish to apply to this certificate in the select field that is available to the user. Appropriate translations must exist in your client.csv file for the **label.id** where necessary. You can learn about how to configure OpenCRVS content translation in the section: [Managing Language Content](3.2.5-set-up-application-settings/3.2.9.1-managing-language-content/).
115
-
* The **isDefault** property can only be applied to **one item per event**. Its the first item users will see in the select UI form field when choosing a certificate.
116
-
* The **fee** property allows you to configure unique fees for the certificate type. Defaults are applied from applcation-config.ts
117
-
* The **svgUrl** property is self explanatory. The SVG file must exist in this location.
118
-
* The **fonts** property, as above, must point to ttf font files that exist in the referenced location.
112
+
- The **id** property must be unique.
113
+
- The **event** property must be set to the supported `Event.<prop>` provided to you by TypeScript.
114
+
- The **label** property must be a [react-intl formatjs ](https://www.npmjs.com/package/react-intl)object with a translation for the visible label that you wish to apply to this certificate in the select field that is available to the user. Appropriate translations must exist in your client.csv file for the **label.id** where necessary. You can learn about how to configure OpenCRVS content translation in the section: [Managing Language Content](3.2.5-set-up-application-settings/3.2.9.1-managing-language-content/).
115
+
- The **isDefault** property can only be applied to **one item per event**. Its the first item users will see in the select UI form field when choosing a certificate.
116
+
- The **fee** property allows you to configure unique fees for the certificate type. Defaults are applied from applcation-config.ts
117
+
- The **svgUrl** property is self explanatory. The SVG file must exist in this location.
118
+
- The **fonts** property, as above, must point to ttf font files that exist in the referenced location.
119
+
120
+
## Multi-Page Certificate Support
121
+
122
+
Previously, our certificate generation system only supported single-page SVG certificate templates. Some countries might need to issue certificates that span two or more pages, which required extending our SVG→PDF pipeline and certificate preview UI.
123
+
124
+
We have introduced first-class multi-page certificate support in this version.
125
+
126
+
The feature allows:
127
+
128
+
- Multiple pages defined inside one SVG using data-page markers
129
+
- Automatic splitting of the SVG into page-specific PDF content
130
+
- Correct page-by-page preview for staff verification before final document generation
131
+
- Compatibility with existing absolutely-positioned svg templates
132
+
- Backwards compatibility with single-page SVG templates
133
+
134
+
### How Multi-Page Certificates Are Defined
135
+
136
+
Multi-page templates are delivered as one master SVG containing different page sections.
137
+
Each page is wrapped in a <g> element marked with the attribute:
138
+
139
+
```
140
+
<g data-page="1">
141
+
...
142
+
</g> <!-- Content for page 1 goes here-->
143
+
144
+
<g data-page="2">
145
+
... <!-- Content for page 1 goes here-->
146
+
</g>
147
+
```
148
+
149
+
An example certificate configuration [can be found here](https://github.com/opencrvs/opencrvs-countryconfig/blob/release-v1.9.2/src/api/certificates/source/v2.tennis-club-membership-certificate-multipage.svg?short_path=6fa63f6#L2)
150
+
151
+
## Hiding Header and Footer on Security Paper Certificates
152
+
153
+
Security-paper–based certificates already contain their own official background, headers, footers, qr code printed on the physical security paper itself.
154
+
155
+
Because of that, No app-generated header, footer or qr code must appear.
156
+
Any extra header/footer/qr code would overlap the preprinted design and invalidate the document.
157
+
158
+
In such case, we need to design first a svg template with absolute positioning of svg elements including header, footer and qr code. And once it renders correctly, we add condition to hide it dynamically using the `preview` variable.
159
+
160
+
An example certificate configuration [can be found here](https://github.com/opencrvs/opencrvs-countryconfig/blob/release-v1.9.2/src/api/certificates/source/v2.birth-certificate.svg?short_path=da46a2e#L4)
0 commit comments