/**
  * Output the certificate PDF.
  *
  * @param array $data Certificate data.
  */
 public function output_pdf($data)
 {
     require_once dirname(__FILE__) . '/../lib/tfpdf/tfpdf.php';
     if ('L' != $data['orientation']) {
         $data['orientation'] = 'P';
     }
     $pdf = new TFPDF($data['orientation'], 'pt', $data['page_size']);
     $pdf->SetAutoPageBreak(false);
     $pdf->AddPage();
     $pdf->SetFont('helvetica', '', 12);
     $w = $data['page_size'][0];
     $h = $data['page_size'][1];
     if ('L' == $data['orientation']) {
         $w = $data['page_size'][1];
         $h = $data['page_size'][0];
     }
     $pdf->Image($data['image'], 0, 0, $w, $h, '', '');
     $search = array('{date}', '{course_title}', '{student_name}');
     $replace = array($data['date'], $data['course_title'], $data['student_name']);
     $line_height = 1.6;
     $valid_align = array('L', 'C', 'R', 'J');
     foreach ($data['blocks'] as $block) {
         $x = $block['x'];
         $y = $block['y'];
         $width = $block['width'];
         $height = $block['height'];
         $align = in_array($block['align'], $valid_align) ? $block['align'] : 'L';
         $font_size_pt = $block['font_size'];
         $line_height_mm = $font_size_pt * $line_height;
         $pdf->SetFontSize($font_size_pt);
         $pdf->SetXY($x, $y);
         $pdf->MultiCell($width, $line_height_mm, str_replace($search, $replace, $block['content']), 0, $align, false);
     }
     $pdf->Output($data['file_name'], 'I');
 }
Example #2
0
DB::$error_handler = 'db_error_handler';
$link = mysqli_connect($server, $user, $pass, $database, $port);
$link->set_charset($encoding);
//Build tree
$tree = new SplClassLoader('Tree\\NestedTree', $_SESSION['settings']['cpassman_dir'] . '/includes/libraries');
$tree->register();
$tree = new Tree\NestedTree\NestedTree(prefix_table("nested_tree"), 'id', 'parent_id', 'title');
//Constant used
$nbElements = 20;
// Construction de la requ?te en fonction du type de valeur
switch ($_POST['type']) {
    #CASE generating the log for passwords renewal
    case "log_generate":
        //Prepare the PDF file
        include $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Pdf/Tfpdf/tfpdf.class.php';
        $pdf = new TFPDF();
        //Add font for utf-8
        $pdf->AddFont('DejaVu', '', 'DejaVuSansCondensed.ttf', true);
        $pdf->aliasNbPages();
        $pdf->addPage();
        $pdf->SetFont('DejaVu', '', 16);
        $pdf->Cell(0, 10, $LANG['pdf_del_title'], 0, 1, 'C', false);
        $pdf->SetFont('DejaVu', '', 12);
        $pdf->Cell(0, 10, $LANG['pdf_del_date'] . date($_SESSION['settings']['date_format'] . " " . $_SESSION['settings']['time_format'], time()), 0, 1, 'C', false);
        $pdf->SetFont('DejaVu', '', 10);
        $pdf->SetFillColor(15, 86, 145);
        $pdf->cell(80, 6, $LANG['label'], 1, 0, "C", 1);
        $pdf->cell(75, 6, $LANG['group'], 1, 0, "C", 1);
        $pdf->cell(21, 6, $LANG['date'], 1, 0, "C", 1);
        $pdf->cell(15, 6, $LANG['author'], 1, 1, "C", 1);
        $pdf->SetFont('DejaVu', '', 10);
Example #3
0
 function Ln($p_step = null)
 {
     if ($this->bigger == 0) {
         parent::Ln($p_step);
     }
     parent::Ln($this->bigger);
     $this->bigger = 0;
 }