Note that there are some explanatory texts on larger screens.

plurals
  1. POBlank Output PDF using FPDF library - codeigniter
    primarykey
    data
    text
    <p>I'm going to generate a PDF report using FPDF library, but the output is blank. There is no error displayed, how can I fix this problem? </p> <p>Anyway, I tried this code in LOCALHOST and it works perfectly, but when I upload it to the cloud, there's no output to be displayed.. I tried to make the function output like this..</p> <pre><code>$this-&gt;fpdf-&gt;OUTPUT('try.pdf','I'); but nothing happens.. </code></pre> <p>NOTE: In my output, C:/backup/employee_..php, the output is in the folder, there's no error and it works fine.. but when I upload this one, there no output to be display</p> <p>This is my CONTROLLER:</p> <pre><code>public function backup_employees_pdf() { $this-&gt;load-&gt;library('fpdf'); define('FPDF_FONTPATH',$this-&gt;config-&gt;item('fonts_path')); $this-&gt;fpdf =new FPDF('L', 'mm', 'Legal', true, 'UTF-8', false); $this-&gt;fpdf-&gt;AliasNbPages(); $this-&gt;fpdf-&gt;AddPage(); //load data $data = array(); $row = $this-&gt;m_employee-&gt;load_data_employees(); $data = $row-&gt;result(); // Whatever written here will come in header of the pdf file. $this-&gt;fpdf-&gt;Image('assets/images1/mpowerstafflogo.jpg',10,5,50,50,'','www.mpowerstaff.com'); $this-&gt;fpdf-&gt;SetFont('Arial','B',15); $this-&gt;fpdf-&gt;Cell(140); $this-&gt;fpdf-&gt;Cell(50,10,'Employee File Management Website',0,0,'C'); $this-&gt;fpdf-&gt;Ln(5); $this-&gt;fpdf-&gt;Cell(140); $this-&gt;fpdf-&gt;Ln(5); $this-&gt;fpdf-&gt;SetFont('Arial','',12); $this-&gt;fpdf-&gt;Cell(140); $this-&gt;fpdf-&gt;Cell(50,10,'3F Room 305 Jackson Bldg. 926 Arnaiz Ave., San Loreno Village Makati City, 1223 PHILIPPINES',0,0,'C'); $this-&gt;fpdf-&gt;Ln(5); $this-&gt;fpdf-&gt;Ln(5); $this-&gt;fpdf-&gt;Cell(140); $this-&gt;fpdf-&gt;Cell(50,10,'Tel. (632) 810-4026 * 810-9121',0,0,'C'); $this-&gt;fpdf-&gt;Ln(5); $this-&gt;fpdf-&gt;Ln(5); $this-&gt;fpdf-&gt;Cell(140); $this-&gt;fpdf-&gt;Cell(50,10,'Email: mpowerstaff@yahoo.com',0,0,'C'); $this-&gt;fpdf-&gt;Ln(10); $this-&gt;fpdf-&gt;SetFont('Arial','B',12); $this-&gt;fpdf-&gt;Cell(140); $this-&gt;fpdf-&gt;Cell(50,10,'Employees Report',0,0,'C'); $this-&gt;fpdf-&gt;Ln(15); // Colors, line width and bold font $this-&gt;fpdf-&gt;SetFillColor(105,100,231); $this-&gt;fpdf-&gt;SetTextColor(255); $this-&gt;fpdf-&gt;SetDrawColor(60,89,117); $this-&gt;fpdf-&gt;SetLineWidth(0.3); $this-&gt;fpdf-&gt;SetFont('', 'B'); // Header $w = array(35,80,40,40,40,40,61); $this-&gt;fpdf-&gt;Ln(); //border LRTB $this-&gt;fpdf-&gt;Cell(5); $this-&gt;fpdf-&gt;Cell(90,10,'NAME',1,0,'C', 'LR'); $this-&gt;fpdf-&gt;Cell(60,10,'ACCOUNT NUMBER',1,0,'C', 'LR'); $this-&gt;fpdf-&gt;Cell(60,10,'ADDRESS',1,0,'C', 'LR'); $this-&gt;fpdf-&gt;Cell(60,10,'BIRTHDAY',1,0,'C', 'LR'); $this-&gt;fpdf-&gt;Cell(60,10,'CONTACT NO.',1,0,'C', 'LR'); $this-&gt;fpdf-&gt;Ln(10); // Color and font restoration $this-&gt;fpdf-&gt;SetFillColor(224, 235, 255); $this-&gt;fpdf-&gt;SetTextColor(0); $this-&gt;fpdf-&gt;SetFont(''); $fill = 0; //data foreach($data as $empsItem) { $this-&gt;fpdf-&gt;Cell(5); $this-&gt;fpdf-&gt;Cell(90,10,$empsItem-&gt;name,1,0,'C',$fill); $this-&gt;fpdf-&gt;Cell(60,10,$empsItem-&gt;account_no,1,0,'C',$fill); $this-&gt;fpdf-&gt;Cell(60,10,$empsItem-&gt;address,1,0,'C',$fill); $this-&gt;fpdf-&gt;Cell(60,10,$empsItem-&gt;birthday,1,0,'C',$fill); $this-&gt;fpdf-&gt;Cell(60,10,$empsItem-&gt;contact_no,1,0,'C',$fill); $this-&gt;fpdf-&gt;Ln(10); $fill=!$fill; } $this-&gt;fpdf-&gt;Ln(30); $this-&gt;fpdf-&gt;SetFont('Arial','B',10); $this-&gt;fpdf-&gt;Cell(20, 5,'Total Employees: '.$row-&gt;num_rows(), '', 0, 'LR', 0); $this-&gt;fpdf-&gt;SetY(184); $this-&gt;fpdf-&gt;SetFont('Arial','I',8); $this-&gt;fpdf-&gt;Cell(0,10,'Copyright. All Rights Reserved',0,0,'C'); $this-&gt;fpdf-&gt;Cell(0,10,'Page '.$this-&gt;fpdf-&gt;PageNo().' of {nb}',0,0,'C'); $dir = 'C:/backup/'; $filename = "employee report"; $this-&gt;fpdf-&gt;Output($dir.$filename.'.pdf'); } </code></pre> <p>//====THIS IS MY MODEL===//</p> <pre><code>public function load_data_employees() { $query = $this-&gt;db-&gt;query("SELECT concat(e_first_name,' ',e_middle_name,' ',e_last_name) AS 'name',account_number AS 'account_no',address AS 'address',birthday AS 'birthday',contact_number AS 'contact_no'FROM tb_emp where status='available'"); return $query; } </code></pre> <p>//== CONFIG.PHP==//</p> <pre><code>$config['fonts_path']= "./system/fonts/font/"; </code></pre> <p>that's the details. I tried to fix this but still, there no output.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload