Advertisement
jamboljack

mPDF beda Header

Apr 12th, 2022
1,578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.39 KB | None | 0 0
  1. public function printpdf($gaji_id)
  2.     {
  3.         ini_set('memory_limit', '-1');
  4.         $gaji_id          = $this->secure->decrypt_url($gaji_id);
  5.         $detail           = $this->db->get_where('v_gaji', array('gaji_id' => $gaji_id))->row();
  6.         $data['detail']   = $this->db->get_where('v_gaji', array('gaji_id' => $gaji_id))->row();
  7.         $data['listData'] = $this->db->order_by('pegawai_nama', 'asc')->get_where('v_detail_gaji', array('gaji_id' => $gaji_id))->result();
  8.         $time             = time();
  9.         $filename         = 'Tanda-Terima-Pembayaran-Gaji-Non-PNS-' . $time;
  10.         $mpdf             = new \Mpdf\Mpdf(['format' => [210, 330], 'tempDir' => '/../../tmp']);
  11.         $mpdf->SetTitle('Tanda Terima Pembayaran Gaji Non PNS');
  12.         $mpdf->SetHTMLHeader('<br>
  13.                <table width="100%" cellpadding="2" cellspacing="2">
  14.                    <tr>
  15.                        <td width="100%" align="center">
  16.                            <div style="font-size:12px;"><b>TANDA TERIMA PEMBAYARAN GAJI NON PNS</b></div>
  17.                            <div style="font-size:12px;"><b>BULAN : ' . strtoupper(getBulan($detail->gaji_bulan)) . ' ' . $detail->gaji_tahun . '</b></div>
  18.                        </td>
  19.                    </tr>
  20.                </table>
  21.                <hr class="s3">');
  22.         $mpdf->AddPage('L', '', '', '', '', 5, 5, 23, 6, 6, 3);
  23.         $mpdf->SetHTMLHeader('<br><br><br>
  24.        <table width="100%" border="1">
  25.        <tr>
  26.            <th width="3%">NO</th>
  27.            <th width="10%">OPD</th>
  28.            <th width="6%">NIPD</th>
  29.            <th width="8%">NIK</th>
  30.            <th>NAMA</th>
  31.            <th width="8%">NO. REK BANK</th>
  32.            <th width="10%">NAMA BANK</th>
  33.            <th width="10%">JABATAN</th>
  34.            <th width="6%">HONOR/GAJI</th>
  35.            <th width="6%">IUR. BPJS 4%</th>
  36.            <th width="6%">IUR. BPJS 1%</th>
  37.            <th width="6%">GAJI DITERIMA</th>
  38.            <th width="10%">TANDA TANGAN</th>
  39.        </tr>
  40.        </table>');
  41.         $html = $this->load->view('print/printgajipdf_v', $data, true);
  42.         $mpdf->WriteHTML($html);
  43.         $pdfFilePath = FCPATH . "download/$filename.pdf";
  44.         $mpdf->Output($pdfFilePath, 'F');
  45.         header("Content-type: application/pdf");
  46.         header("Content-Length:" . filesize($pdfFilePath));
  47.         readfile($pdfFilePath);
  48.         exit;
  49.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement