Using MPDF to create Professiona Certificate

Using MPDF to create Professiona Certificate

The MPDF is a handy tool to create the PDF’s and you can create them as ease here is what we created 2 PDF and the code is as below

You can include external style sheet like

filename = "".get_stylesheet_directory()."/style.css";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
ob_clean();
$mpdf = new mPDF('','', 0, '', 10, 10, 10, 10, 0,0, 'L');
$mpdf->WriteHTML($contents,1);
$mpdf->WriteHTML($pdf,2);

//Write To Disk
$mpdf->Output(get_stylesheet_directory().'/pdf/'.$user_details['display_name'].'-Offer-'.date('d.M.Y').'.pdf','F');
//Download To Browser
$mpdf->Output($user_details['display_name'].'-Offer-'.date('d.M.Y').'.pdf','D');

A Full Blows Example of Profession Certificate is below followed by code used to create it.

Download PDF Sample

user_login;
$username             = $user_info->user_login;
$first_name           = $user_info->first_name;
$last_name            = $user_info->last_name;
$Certification_number = get_user_meta($current_user_id,'certification_number',true);
$Certification_date   = date('d M Y');
$membership_category  = unserialize(get_user_meta($current_user_id,'membership_category',true));
$After_implod         = implode(',',$membership_category);
$Certification_name   = $first_name.' '.$last_name;
$imgPath              = $Plugin_path.'/head.jpg';
$backImgpath          = $Plugin_path.'/globe2.jpg';
$mpdf                 = new \Mpdf\Mpdf([
    'mode'        => 'utf-8',
    'format'      => 'Letter-L',
    'orientation' => 'L',
]);
$content ='';   
if(in_array($type, $membership_category) && $type == 'CP'){
    $content .='
    
    
    
    
    
    
    
    
    TEP Certificate
    
    
    ';
    $content .= '
'.$imgPath
'; $content .='
Let It Be Known That

'.$Certification_name.', '. $type.'

Has completed 780 Hours of training, and one year of supervised practice in psychodrama, sociometry and group psychotherapy, passed both a written and an on‐site examination and is certified as a

Practitioner
In
Psychodrama, Sociometry & Group Psychotherapy
Catherine D.Nugent, L.C.P.C., T.E.P

President, American Board of Examiners in Psychodrama, Sociometry & Group Psychotherapy

Certification Date:'.date('m/d/Y',strtotime($Certification_date)).'

Expiration Date: 01 Jan 2021

Certification No.:'.$Certification_number.'

'; $content .= ''; $mpdf->autoScriptToLang = true; $mpdf->autoLangToFont = true; $mpdf->WriteHTML($content); //$mpdf->Output(); $mpdf->Output($type.'_'.$Certification_number.'_'.date('m.d.Y').'.pdf','I'); } if(in_array($type, $membership_category) && $type == 'TEP'){ $content .=' TEP Certificate '; $content .= '
'.$imgPath
'; $content .='
Let It Be Known That

'.$Certification_name.', '. $type.'

Has previously been certified as a practitioner (completing 780 Hours of training,
one year of supervised practice, and passed both a written and an on‐site examination);
has completed an additional three years of progressively responsible training, supervision and professional
development as a trainer, educator and practitioner in psychodrama, sociometry and group psychotherapy
and has passed both a written and an on‐site examination and is certified as a

Trainer, Educator & Practitioner
In
Psychodrama, Sociometry & Group Psychotherapy
Catherine D.Nugent, L.C.P.C., T.E.P

President, American Board of Examiners in Psychodrama, Sociometry & Group Psychotherapy

Certification Date:'.date('m/d/Y',strtotime($Certification_date)).'

Expiration Date: 01 Jan 2021

Certification No.:'.$Certification_number.'

'; $content .= ''; $mpdf->autoScriptToLang = true; $mpdf->autoLangToFont = true; $mpdf->WriteHTML($content); //$mpdf->Output(); $mpdf->Output($type.'_'.$Certification_number.'_'.date('m.d.Y').'.pdf','I'); } ?>

Leave a Reply

Your email address will not be published. Required fields are marked *