emprit

tcpdf

Oct 24th, 2012
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2. class Cetak_admin extends Controller {
  3.    
  4.     function index(){
  5.         $this->load->library('pdf');
  6.         require_once(APPPATH . 'third_party/tcpdf/config/lang/eng.php');
  7. require_once(APPPATH . 'third_party/tcpdf/tcpdf.php');
  8. // create new PDF document
  9. $pdf = new TCPDF('Landscape', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  10.  
  11. // set document information
  12. $pdf->SetCreator(PDF_CREATOR);
  13. $pdf->SetAuthor('Zawa');
  14. $pdf->SetTitle('KRS Mahasiswa');
  15. $pdf->SetSubject('KRS');
  16.  
  17. $pdf->setPrintHeader(false);
  18. $pdf->setPrintFooter(false);
  19.  
  20. // set default monospaced font
  21. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  22.  
  23. //set margins
  24. $pdf->SetMargins(PDF_MARGIN_LEFT, 10, PDF_MARGIN_RIGHT);
  25.  
  26. //set auto page breaks
  27. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  28.  
  29. //set image scale factor
  30. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  31.  
  32. //set some language-dependent strings
  33. $pdf->setLanguageArray($l);
  34. // ---------------------------------------------------------
  35.  
  36. // add a page
  37. $pdf->AddPage();
  38. $pdf->SetFont('times', '', 14);
  39. $tbl = '<div>Tampilin data ada disini, bisa d masukkan data dari database</div>';
  40. $pdf->writeHTML($tbl, true, false, true, false, '');
  41. $pdf->Output("KRS.pdf", 'D');
  42.     }
  43. }
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment