Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Cetak_admin extends Controller {
- function index(){
- $this->load->library('pdf');
- require_once(APPPATH . 'third_party/tcpdf/config/lang/eng.php');
- require_once(APPPATH . 'third_party/tcpdf/tcpdf.php');
- // create new PDF document
- $pdf = new TCPDF('Landscape', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
- // set document information
- $pdf->SetCreator(PDF_CREATOR);
- $pdf->SetAuthor('Zawa');
- $pdf->SetTitle('KRS Mahasiswa');
- $pdf->SetSubject('KRS');
- $pdf->setPrintHeader(false);
- $pdf->setPrintFooter(false);
- // set default monospaced font
- $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
- //set margins
- $pdf->SetMargins(PDF_MARGIN_LEFT, 10, PDF_MARGIN_RIGHT);
- //set auto page breaks
- $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
- //set image scale factor
- $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
- //set some language-dependent strings
- $pdf->setLanguageArray($l);
- // ---------------------------------------------------------
- // add a page
- $pdf->AddPage();
- $pdf->SetFont('times', '', 14);
- $tbl = '<div>Tampilin data ada disini, bisa d masukkan data dari database</div>';
- $pdf->writeHTML($tbl, true, false, true, false, '');
- $pdf->Output("KRS.pdf", 'D');
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment