School Certificate PDF Preview & Email
Overview
The School Certificate desk form now includes an embedded PDF preview section and two role-gated action buttons — Email Certificate and Print Certificate — visible only to users with one of the following roles: School Director, Registrar, System Manager, or Academics User.
PDF Preview
When a certificate has a generated PDF (pdf_file is set), the Preview
section at the bottom of the form renders an inline iframe (640 px tall) so staff can verify
the certificate without downloading.
The preview updates automatically when the PDF is regenerated.
Email Certificate
- Open any saved School Certificate record in Frappe Desk.
- Click Actions → Email Certificate.
- The dialog pre-fills the To field with the student’s
student_email_id(or linked User email). Edit if needed. - Optionally add a plain-text note that will appear as the email body.
- Click Send. The PDF is attached automatically.
Backend: certificate_engine.email_certificate(cert_name, to_email, note).
If no PDF exists it is generated on the fly before sending.
Print Certificate
Actions → Print Certificate opens the PDF in a new browser tab, from which the browser’s native print dialog can be used.
Generating a PDF
If no PDF exists yet, use Actions → Regenerate PDF.
This calls certificate_engine.regenerate_certificate_pdf(cert_name)
and reloads the form once complete.
Technical Reference
school_certificate.js— form refresh hook;_renderPreview()populates thepdf_previewHTML field;_showEmailDialog()handles the dialogcertificate_engine.email_certificate()— whitelisted; role-gated; usesfrappe.sendmail()with raw PDF bytes as attachment- DocType:
section_break_preview(depends_on: pdf_file) +pdf_preview(HTML field, no DB column) - Shipped in v0.52.0, commit
748db76