From c58f5efcddd7f9bd2af06815f0dedf6809324447 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 8 Aug 2022 16:40:40 +0530 Subject: [PATCH] feat: export certificate --- .../lms_certificate/lms_certificate.py | 6 +++ lms/public/css/style.css | 2 +- lms/templates/certificate.html | 35 ++++++------ lms/www/courses/certificate.html | 6 +-- lms/www/courses/certificate.js | 54 ++++++++++++++----- 5 files changed, 71 insertions(+), 32 deletions(-) diff --git a/lms/lms/doctype/lms_certificate/lms_certificate.py b/lms/lms/doctype/lms_certificate/lms_certificate.py index 93487cad..2467fff9 100644 --- a/lms/lms/doctype/lms_certificate/lms_certificate.py +++ b/lms/lms/doctype/lms_certificate/lms_certificate.py @@ -42,3 +42,9 @@ def create_certificate(course): }) certificate.save(ignore_permissions=True) return certificate + +@frappe.whitelist() +def get_certificate_pdf(html): + frappe.local.response.filename = "certificate.pdf" + frappe.local.response.filecontent = get_pdf(html, {"orientation": "LandScape"}) + frappe.local.response.type = "pdf" diff --git a/lms/public/css/style.css b/lms/public/css/style.css index 25691d06..476d63f4 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -829,7 +829,7 @@ pre { .certificate-content { background-color: #FFFFFF; - border-width: 100px; + border-width: 10px; border-style: solid; } diff --git a/lms/templates/certificate.html b/lms/templates/certificate.html index 8064b42c..e798cc1d 100644 --- a/lms/templates/certificate.html +++ b/lms/templates/certificate.html @@ -1,30 +1,35 @@ -
-
- -
+ +
+
+ +
{{ _("This certifies that") }}
-
{{ member.full_name }}
-
{{ _("has successfully completed the course on") }} +
{{ member.full_name }}
+
{{ _("has successfully completed the course on") }} {{ course.title }} on {{ frappe.utils.format_date(certificate.issue_date, "medium") }}.
-