Advertisement
oimtrust

mpdf

Jun 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1. <?php
  2.     include '../public/MPDF57/mpdf.php';
  3.     include_once '../apps/model/class.survey.php';
  4.  
  5.       session_start();
  6.  
  7.       $survey   = new Survey();
  8.  
  9.       if (!isset($_SESSION['username'])) {
  10.         $survey->redirect('login.php');
  11.       }
  12.  
  13.      $query  = $survey->execute("SELECT tpoint.id_point, student.npm, student.fullname, tpoint.total
  14.                FROM tbl_student AS student LEFT JOIN tbl_point AS tpoint ON student.npm = tpoint.npm
  15.                WHERE student.npm");
  16.  
  17.       $now  = date("F j, Y, g:i a");
  18.  
  19.     $html   .= "<html>
  20. <head>
  21. </head>
  22. <body>
  23.     <h3>Laporan Nilai Mahasiswa</h3>
  24.     <h5>Dicetak pada : $now</h5>
  25.  <table class='bpmTopicC'>
  26.    <thead>
  27.      <tr class='headerrow'>
  28.         <th>No</th>
  29.        <th>NPM</th>
  30.        <th>Nama</th>
  31.        <th>Skor</th>
  32.      </tr>
  33.    </thead>";
  34.     $no = 0;
  35.     while ($row = $query->fetch_object()) {
  36.         $no++;
  37.  
  38.         $html .= "<tbody>
  39.      <tr>
  40.         <td class='layout'>$no</td>
  41.        <td class='layout'>$row->npm</td>
  42.        <td class='layout'>$row->fullname</td>
  43.        <td class='layout'>$row->total</td>
  44.      </tr>
  45.    </tbody>
  46.  </table>";
  47.  
  48. }
  49.     $html .= "</body></html>";
  50.    
  51.    $fileName = 'reportHistoryRubric--' . date('d-m-Y') . '-' . date('h.i.s');
  52.  
  53.     $mpdf=new mPDF('utf-8', 'A4','','',32,25,27,25,16,13);
  54.     $mpdf->SetDisplayMode('fullpage');
  55.     // LOAD a stylesheet
  56.     $stylesheet = file_get_contents('../public/MPDF57/examples/mpdfstyletables.css');
  57.     $mpdf->WriteHTML($stylesheet,1);
  58.     $mpdf->WriteHTML($html, 2);
  59.  
  60.     $mpdf->Output($fileName. '.pdf','D');
  61.     exit;
  62.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement