Files

36 lines
1.2 KiB
PHP

<?php
Class Laporanpdf extends CI_Controller{
function __construct() {
parent::__construct();
$this->load->library('pdf');
}
function index(){
$pdf = new FPDF('p','mm','A4');
// membuat halaman baru
$pdf->AddPage();
// setting jenis font yang akan digunakan
$pdf->SetFont('Arial','B',16);
// mencetak string
$pdf->Cell(190,7,'LAPORAN REKAP DATA BERKAS PPDB',0,1,'C');
$pdf->SetFont('Arial','B',12);
$pdf->Cell(190,7,'SMK AL-MUHTADIN DEPOK',0,1,'C');
// Memberikan space kebawah agar tidak terlalu rapat
$pdf->Cell(10,7,'',0,1);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(20,6,'NO. PEND',1,0);
$pdf->Cell(85,6,'NAMA SISWA',1,0);
$pdf->Cell(30,6,'TEMPAT LAHIR',1,0);
$pdf->Cell(33,6,'TANGGAL LAHIR',1,1);
$pdf->SetFont('Arial','',10);
$siswa = $this->db->get('data_siswa')->result();
foreach ($siswa as $row){
$pdf->Cell(20,6,$row->no_pendaftaran,1,0);
$pdf->Cell(85,6,$row->nama_lengkap,1,0);
$pdf->Cell(30,6,$row->tempat_lahir,1,0);
$pdf->Cell(33,6,$row->tgl_lahir,1,1);
}
$pdf->Output();
}
}