Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function preview($id)
- {
- $this->load->library('Pdf');
- $data['detail'] = $this->siup_model->select_sk($id)->row();
- $dataSK = $this->db->get_where('c39_siup_datapemilik', array('id' => $id))->row();
- if (count($dataSK) > 0) {
- // Nama File PDF
- $time = time();
- $filename = 'SK-SIUP-' . $id . '-' . $time;
- $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
- $pdf->SetTitle('Cetak SK SIUP');
- $pdf->SetHeaderMargin(15);
- $pdf->SetTopMargin(10);
- $pdf->setFooterMargin(10);
- $pdf->setPrintHeader(false);
- $pdf->setPrintFooter(false);
- $pdf->setFontSubsetting(true);
- $pdf->SetAutoPageBreak(true);
- $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
- if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
- require_once dirname(__FILE__) . '/lang/eng.php';
- $pdf->setLanguageArray($l);
- }
- $pagelayout = array(210, 330); // F4
- $pdf->AddPage('P', $pagelayout);
- $style = array(
- 'border' => false,
- 'vpadding' => 'auto',
- 'hpadding' => 'auto',
- 'fgcolor' => array(0, 0, 0),
- 'bgcolor' => false, //array(255,255,255)
- 'module_width' => 1, // width of a single module in points
- 'module_height' => 1, // height of a single module in points
- );
- // Data Barcode
- $data['qrcode'] = $pdf->write2DBarcode('http://bpmppt.kuduskab.go.id/signature/' . $filename . '.pdf', 'QRCODE,H', 80, 210, 50, 50, $style, 'N');
- // View
- $html = $this->load->view('kadin/siup/template_siup_v', $data, true, false, true, false, '');
- $pdf->writeHTML($html);
- $pdf->lastPage();
- $pdfFilePath = FCPATH . "signature/$filename.pdf";
- $pdf->Output($pdfFilePath, 'F');
- header("Content-type: application/pdf");
- header("Content-Length:" . filesize($pdfFilePath));
- readfile($pdfFilePath);
- exit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement