application/controllers/Biodata.php
// export to pdf with library fpdf
export to pdf with library fpdf
export to pdf with library fpdf
public function ex_pdf($uniqueId = null) {
		ob_start(); 
		$get_bio = $this->M_Biodata->get_by_uniqueid(['BioUniqueId' => $uniqueId]); 
		$this->load->library('PDF'); 
		$fpdf = new FPDF('L', 'mm', 'A4'); 
		$fpdf->SetAutoPageBreak(false); 
		$fpdf->AddPage(); 
		$fpdf->SetFont('Times', 'B', 46); 
		$fpdf->Cell(100, 20, 'Kartu Tanda Penduduk', 0, 1); 
		$fpdf->SetFont('Times', 'B', 24); 
		$fpdf->setFillColor(50, 168, 164); 
		$fpdf->Cell(70, 20, 'NIK', 0, 0, 'L', 1); 
		$fpdf->Cell(205, 15, $get_bio->BioUniqueId, 0, 1, 'L', 1);
		$fpdf->SetFont('Times', '', 20); 
		$fpdf->Cell(70, 16, 'Nama', 0, 0, 'L', 1);
		$fpdf->Cell(205, 16, ': ' . $get_bio->BioName, 0, 1, 'L', 1);
		$fpdf->Cell(70, 16, 'Tempat/tanggal lahir', 0, 0, 'L',  1);
		$fpdf->Cell(205, 16, ': ' . $get_bio->BioBirthPlace . '/' . $get_bio->BioBirthDate, 0, 1, 'L', 1);
		$fpdf->Cell(70, 16, 'Jenis Kelamin', 0, 0, 'L', 1);
		if ($get_bio->BioGender == 'LL'){
			echo $fpdf->setFillColor(50, 168, 164);
		} else {
			echo $fpdf->setFillColor(50, 0, 164);
		}
		$fpdf->Cell(205, 16, ': ' . $get_bio->BioGender, 0, 1, 'L', 1);
		$fpdf->setFillColor(50, 168, 164); 
		$fpdf->Cell(70, 16, 'Alamat', 0, 0, 'L', 1);
		$fpdf->Cell(205, 16, ': ' . $get_bio->BioAddress, 0, 1, 'L', 1);
		$fpdf->Cell(70, 16, 'Agama', 0, 0, 'L', 1);
		$fpdf->Cell(205, 16, ': ' . $get_bio->BioReligion, 0, 1, 'L', 1);
		$fpdf->Cell(70, 16, 'Status Perkawinan', 0, 0, 'L', 1);
		$fpdf->Cell(205, 16, ': ' . $get_bio->BioStatusMarital, 0, 1, 'L', 1);
		$fpdf->Cell(70, 16, 'Edukasi', 0, 0, 'L', 1);
		$fpdf->Cell(205, 16, ': ' . $get_bio->BioEducation, 0, 1, 'L', 1);
		$fpdf->Cell(70, 16, 'Bahasa', 0, 0, 'L', 1);
		$fpdf->Cell(205, 16, ': ' . $get_bio->BioLanguage, 0, 1, 'L', 1);
		$fpdf->Cell(70, 16, 'Dibuat pada', 0, 0, 'L', 1);
		$fpdf->Cell(205, 16, ': ' . $get_bio->BioCreated, 0, 1, 'L', 1);
		$fpdf->Output('I', 'Biodata.pdf'); 
	}
public function ex_pdf ( $ uniqueId = null ) { ob_start ( ) ; $ get_bio = $ this -> M_Biodata -> get_by_uniqueid ( [ 'BioUniqueId' => $ uniqueId ] ) ; $ this -> load -> library ( 'PDF' ) ; $ fpdf = new FPDF ( 'L' , 'mm' , 'A4' ) ; $ fpdf -> SetAutoPageBreak ( false ) ; $ fpdf -> AddPage ( ) ; $ fpdf -> SetFont ( 'Times' , 'B' , 46 ) ; $ fpdf -> Cell ( 100 , 20 , 'Kartu Tanda Penduduk' , 0 , 1 ) ; $ fpdf -> SetFont ( 'Times' , 'B' , 24 ) ; $ fpdf -> setFillColor ( 50 , 168 , 164 ) ; $ fpdf -> Cell ( 70 , 20 , 'NIK' , 0 , 0 , 'L' , 1 ) ; $ fpdf -> Cell ( 205 , 15 , $ get_bio -> BioUniqueId , 0 , 1 , 'L' , 1 ) ; $ fpdf -> SetFont ( 'Times' , '' , 20 ) ; $ fpdf -> Cell ( 70 , 16 , 'Nama' , 0 , 0 , 'L' , 1 ) ; $ fpdf -> Cell ( 205 , 16 , ': ' . $ get_bio -> BioName , 0 , 1 , 'L' , 1 ) ; $ fpdf -> Cell ( 70 , 16 , 'Tempat/tanggal lahir' , 0 , 0 , 'L' , 1 ) ; $ fpdf -> Cell ( 205 , 16 , ': ' . $ get_bio -> BioBirthPlace . '/' . $ get_bio -> BioBirthDate , 0 , 1 , 'L' , 1 ) ; $ fpdf -> Cell ( 70 , 16 , 'Jenis Kelamin' , 0 , 0 , 'L' , 1 ) ; if ( $ get_bio -> BioGender == 'LL' ) { echo $ fpdf -> setFillColor ( 50 , 168 , 164 ) ; } else { echo $ fpdf -> setFillColor ( 50 , 0 , 164 ) ; } $ fpdf -> Cell ( 205 , 16 , ': ' . $ get_bio -> BioGender , 0 , 1 , 'L' , 1 ) ; $ fpdf -> setFillColor ( 50 , 168 , 164 ) ; $ fpdf -> Cell ( 70 , 16 , 'Alamat' , 0 , 0 , 'L' , 1 ) ; $ fpdf -> Cell ( 205 , 16 , ': ' . $ get_bio -> BioAddress , 0 , 1 , 'L' , 1 ) ; $ fpdf -> Cell ( 70 , 16 , 'Agama' , 0 , 0 , 'L' , 1 ) ; $ fpdf -> Cell ( 205 , 16 , ': ' . $ get_bio -> BioReligion , 0 , 1 , 'L' , 1 ) ; $ fpdf -> Cell ( 70 , 16 , 'Status Perkawinan' , 0 , 0 , 'L' , 1 ) ; $ fpdf -> Cell ( 205 , 16 , ': ' . $ get_bio -> BioStatusMarital , 0 , 1 , 'L' , 1 ) ; $ fpdf -> Cell ( 70 , 16 , 'Edukasi' , 0 , 0 , 'L' , 1 ) ; $ fpdf -> Cell ( 205 , 16 , ': ' . $ get_bio -> BioEducation , 0 , 1 , 'L' , 1 ) ; $ fpdf -> Cell ( 70 , 16 , 'Bahasa' , 0 , 0 , 'L' , 1 ) ; $ fpdf -> Cell ( 205 , 16 , ': ' . $ get_bio -> BioLanguage , 0 , 1 , 'L' , 1 ) ; $ fpdf -> Cell ( 70 , 16 , 'Dibuat pada' , 0 , 0 , 'L' , 1 ) ; $ fpdf -> Cell ( 205 , 16 , ': ' . $ get_bio -> BioCreated , 0 , 1 , 'L' , 1 ) ; $ fpdf -> Output ( 'I' , 'Biodata.pdf' ) ; }
export to pdf with library fpdf
export to pdf with library fpdf
// start content // get data bio by uniqueId // load pdf library // config sheet of pdf // set of page break (auto new page). true -> to new page. false -> all in one page // make new page. page 1 // set font // set column. max width = 279 // set font //set collor // set column. max width = 279 // set font //kreasi //set back // set the output of pdf. view/download/document type