'' , 'align_content' => 'center', 'representante' => '', 'cargo' => '' ); }else{ while ($row = mysqli_fetch_assoc ($result)){ $constancia = $row; } } //Get data user $user = json_decode($_SESSION['usersession']); //get data course if ($_GET['idcourse'] != '') { $idcourse = $_GET['idcourse']; $sql = "SELECT nombre FROM categoria WHERE id = $idcourse"; $result = mysqli_query($link, $sql); if ( mysqli_num_rows($result) <= 0 ) { $course = array('nombre' => 'Cargando...'); }else{ while ($row = mysqli_fetch_assoc ($result)){ $nombre = $row['nombre']; } $course = array('nombre' => $nombre); } }else{ $course = array('nombre' => 'Nombre del Curso'); } // Create an instance of the class: $mpdf = new \Mpdf\Mpdf([ 'mode' => 'utf-8', 'format' => 'letter', 'orientation' => 'L' ]); //Titulo Documento $mpdf->SetTitle('CONSTANCIA'); // Buffer the following html with PHP so we can store it to a variable later ob_start(); // Now collect the output buffer into a variable $html = ob_get_contents(); ob_end_clean(); //CSS $stylesheet = file_get_contents('certificado/certificado.css'); $mpdf->WriteHTML($stylesheet,\Mpdf\HTMLParserMode::HEADER_CSS); $mpdf->WriteHTML($html,\Mpdf\HTMLParserMode::HTML_BODY); //BODY $html = ''; if ($constancia['habilitado_fondo'] == '1') { $html .= ''; }else{ $html .= ''; } if ($constancia['habilitado_logo'] == '1') { $html .= '

'; } $html .= '

Otorga la presente

'; $html .= '

CONSTANCIA A

'; $html .= '

'.$user->nombre.' '.$user->apellido.'

'; $html .= '

por haber acreditado el curso de:

'; $html .= '

'.$course['nombre'].'

'; if ($constancia['firma'] != '') { $html .= '
'; } $html .= '

____________________________________________

'; $html .= '

'.$constancia['representante'].'

'; $html .= '

'.$constancia['cargo'].'

'; // Write some HTML code: $mpdf->WriteHTML($html); // Output a PDF file directly to the browser //$mpdf->Output(); $mpdf->Output('Constancia.pdf', 'I') ; ?>