diff --git a/lms/lms/doctype/lms_certificate/lms_certificate.json b/lms/lms/doctype/lms_certificate/lms_certificate.json index 91ec1085..d1d2a8a2 100644 --- a/lms/lms/doctype/lms_certificate/lms_certificate.json +++ b/lms/lms/doctype/lms_certificate/lms_certificate.json @@ -56,7 +56,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-04-06 11:49:36.077370", + "modified": "2023-04-14 12:33:37.839625", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate", diff --git a/lms/lms/doctype/lms_certificate/lms_certificate.py b/lms/lms/doctype/lms_certificate/lms_certificate.py index 8d01b63d..5e4f8688 100644 --- a/lms/lms/doctype/lms_certificate/lms_certificate.py +++ b/lms/lms/doctype/lms_certificate/lms_certificate.py @@ -5,9 +5,6 @@ import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import add_years, nowdate -from frappe.utils.pdf import get_pdf -from weasyprint import HTML, CSS - from lms.lms.utils import is_certified @@ -48,21 +45,3 @@ def create_certificate(course): ) certificate.save(ignore_permissions=True) return certificate - - -@frappe.whitelist() -def get_certificate_pdf(html_str): - - html = HTML(string=html_str) - css = CSS( - string=""" - @page { - size: A4 landscape; - }""" - ) - main = html.render(stylesheets=[css]) - pdf = main.write_pdf() - - frappe.local.response.filename = "certificate.pdf" - frappe.local.response.filecontent = pdf - frappe.local.response.type = "pdf" diff --git a/lms/lms/print_format/certificate/certificate.json b/lms/lms/print_format/certificate/certificate.json new file mode 100644 index 00000000..f5e01b26 --- /dev/null +++ b/lms/lms/print_format/certificate/certificate.json @@ -0,0 +1,32 @@ +{ + "absolute_value": 0, + "align_labels_right": 0, + "creation": "2023-02-22 21:36:54.560420", + "css": ".certificate-card {\n background: #FFFFFF;\n font-family: \"Inter\" sans-serif;\n font-size: 16px;\n}\n\n.outer-border {\n border-radius: 0.5rem;\n border: 1px solid #EEF0F2;\n padding: 1rem;\n width: 80%;\n margin: auto;\n}\n\n.inner-border {\n border: 10px solid #0089FF;\n border-radius: 8px;\n text-align: center;\n padding: 6rem 4rem;\n background-color: #FFFFFF;\n}\n\n.certificate-logo {\n height: 1.5rem;\n margin-bottom: 4rem;\n}\n\n.certificate-name {\n font-size: 2rem;\n font-weight: 500;\n color: #192734;\n margin-bottom: 0.5rem;\n}\n\n.certificate-footer {\n margin: 4rem auto 0;\n width: 70%;\n text-align: center;\n}\n\n.certificate-footer-item {\n color: #192734;\n}\n\n.cursive-font {\n font-family: cursive;\n font-weight: 600;\n}\n\n.certificate-divider {\n margin: 0.5rem 0;\n}\n\n.certificate-expiry {\n margin-left: 2rem;\n}", + "custom_format": 1, + "disabled": 0, + "doc_type": "LMS Certificate", + "docstatus": 0, + "doctype": "Print Format", + "font_size": 14, + "format_data": "{\"header\":\"
{{ doc.name }}
\\n| \n \n \n {{ _(\"Course Instructor\") }} \n | \n {% endif %}\n \n {% if certificate.expiry_date %}\n | \n \n \n {{ _(\"Expiry Date\") }} \n | \n {% endif %}\n
|
+
+ + {{ _("Course Instructor") }}
+ |
+ {% endif %}
+ {% if certificate.expiry_date %}
+ + |
+
+ + {{ _("Expiry date") }}
+ |
+ {% endif %}
+