Commit
·
c7e38ac
1
Parent(s):
ae15258
Update app.py
Browse files
app.py
CHANGED
|
@@ -343,11 +343,10 @@ def generate_certificate(certificate_model, first_name, last_name):
|
|
| 343 |
# Date of certification
|
| 344 |
d.text((1480, 1170), str(date.today()), fill="black", anchor="mm", font=date_font)
|
| 345 |
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
pdf = background.save("certificate"+".pdf")
|
| 351 |
|
| 352 |
return im, pdf
|
| 353 |
|
|
|
|
| 343 |
# Date of certification
|
| 344 |
d.text((1480, 1170), str(date.today()), fill="black", anchor="mm", font=date_font)
|
| 345 |
|
| 346 |
+
rgba = im
|
| 347 |
+
rgb = Image.new('RGB', im.size, (255, 255, 255)) # white background
|
| 348 |
+
rgb.paste(rgba, mask=rgba.split()[3]) # 3 is the alpha channel
|
| 349 |
+
pdf = rgb.save("certificate.pdf", 'PDF', resolution=100.0)
|
|
|
|
| 350 |
|
| 351 |
return im, pdf
|
| 352 |
|