Skip to content

Commit

Permalink
added compressed certificate templates v3
Browse files Browse the repository at this point in the history
  • Loading branch information
holashchand committed Aug 17, 2023
1 parent 97ad74f commit edda9c9
Show file tree
Hide file tree
Showing 28 changed files with 39 additions and 31 deletions.
Binary file not shown.
43 changes: 25 additions & 18 deletions backend/certificate-pdf-service/services/certificate_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,21 @@ var landscapeDataList []CertificateDataConfig
var portraitDataList = []CertificateDataConfig{
{
x: 206,
y: 183,
y: 238,
fontSize: 18,
template: "{{.CredentialSubject.Name}}",
width: 0,
},
{
x: 205,
y: 354,
y: 409,
fontSize: 11,
template: "{{.CredentialSubject.FatherName}}",
width: 112,
},
{
x: 487.21,
y: 354,
x: 205,
y: 644,
fontSize: 11,
template: "{{.IssuanceDate}}",
width: 0,
Expand All @@ -175,62 +175,69 @@ var portraitDataList = []CertificateDataConfig{
},
{
x: 205,
y: 392,
y: 447,
fontSize: 11,
template: "{{ (index .Evidence 0).RefId}}",
width: 0,
},
{
x: 487.21,
y: 392,
y: 447,
fontSize: 11,
template: "{{.CredentialSubject.BloodGroup}}",
width: 0,
},
{
x: 205,
y: 429,
y: 484,
fontSize: 11,
template: "{{.CredentialSubject.NottoId}}",
width: 0,
},
{
x: 487.21,
y: 429,
y: 484,
fontSize: 11,
template: "{{.EmergencyContact}}",
width: 0,
},
{
x: 205,
y: 471,
y: 524,
fontSize: 11,
template: "{{.CredentialSubject.Pledge.Organs}}",
width: 0,
},
{
x: 205,
y: 509,
y: 564,
fontSize: 11,
template: "{{.CredentialSubject.Pledge.Tissues}}",
width: 0,
},
{
x: 44,
y: 576,
x: 205,
y: 604,
fontSize: 11,
template: "{{.CredentialSubject.Pledge.AdditionalOrgans}}",
width: 0,
},
{
x: 153,
y: 685,
fontSize: 0,
width: 220,
height: 220,
width: 119,
height: 119,
template: "{{.QrCode}}",
formatter: nil,
configType: ImageConfigType,
},
{
x: 50,
y: 184,
x: 56,
y: 235,
fontSize: 0,
width: 132,
height: 140,
width: 119,
height: 126,
template: "{{.Photo}}",
formatter: nil,
configType: ImageConfigType,
Expand Down
3 changes: 2 additions & 1 deletion backend/certificate-pdf-service/services/pdf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ func (p *PdfService) loadFonts() error {
func (p *PdfService) setData(dataConfig CertificateDataConfig, certificateData Certificate) error {
p.pdf.SetX(dataConfig.x)
p.pdf.SetY(dataConfig.y)
p.pdf.SetFillColor(29, 29, 29)
data, err := dataConfig.template.render(certificateData)
if err != nil {
log.Error(err)
return err
}
if err := p.pdf.SetFont("Lato-Regular", "", dataConfig.fontSize); err != nil {
if err := p.pdf.SetFont("Lato-Bold", "", dataConfig.fontSize); err != nil {
log.Error("Error while setting font ", err)
return err
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 12 additions & 12 deletions schemas/Pledge.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,18 @@
}
],
"certificateTemplates": {
"assamese_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Assamese_portrait_",
"bengali_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Bengali_portrait_",
"gujarati_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Gujarati_portrait_",
"hindi_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Hindi_portrait_",
"kannada_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Kannada_portrait_",
"malayalam_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Malayalam_portrait_",
"marathi_portrait":"https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Marathi_portrait_",
"odia_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Odia_portrait_",
"punjabi_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Punjabi_portrait_",
"tamil_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Tamil_portrait_",
"telugu_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Telugu_portrait_",
"urdu_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v2/Urdu_portrait_"
"assamese_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Assamese_portrait_",
"bengali_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Bengali_portrait_",
"gujarati_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Gujarati_portrait_",
"hindi_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Hindi_portrait_",
"kannada_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Kannada_portrait_",
"malayalam_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Malayalam_portrait_",
"marathi_portrait":"https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Marathi_portrait_",
"odia_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Odia_portrait_",
"punjabi_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Punjabi_portrait_",
"tamil_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Tamil_portrait_",
"telugu_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Telugu_portrait_",
"urdu_portrait": "https://raw.githubusercontent.com/Sunbird-RC/demo-donor-registry/main/pledgecertificates/portrait_templates_v3/Urdu_portrait_"
}
}
}

0 comments on commit edda9c9

Please sign in to comment.