Welcome Guest, Not a member yet? Register   Sign In
Generate PDF using FPDF library: Blank Output/Page
#1

[eluser]static void[/eluser]
Sir, I have a problem:I'm going to generate a PDF report using FPDF library, but the output is BLANK.. there no error displayed, how can I fix this problem?

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..

$this->fpdf->OUTPUT('try.pdf','I'); but nothing happens..

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

Quote:this is my CONTROLLER:

Code:
public function backup_employees_pdf() {

$this->load->library('fpdf');  

        define('FPDF_FONTPATH',$this->config->item('fonts_path'));
        $this->fpdf =new FPDF('L', 'mm', 'Legal', true, 'UTF-8', false);
        $this->fpdf->AliasNbPages();
        $this->fpdf->AddPage();

        //load data
        $data = array();
        $row = $this->m_employee->load_data_employees();
        $data = $row->result();

        // Whatever written here will come in header of the pdf file.

      
        $this->fpdf->SetFont('Arial','B',12);
        $this->fpdf->Cell(140);
        $this->fpdf->Cell(50,10,'Employees Report',0,0,'C');
        $this->fpdf->Ln(15);

        // Colors, line width and bold font
        $this->fpdf->SetFillColor(105,100,231);
        $this->fpdf->SetTextColor(255);
        $this->fpdf->SetDrawColor(60,89,117);
        $this->fpdf->SetLineWidth(0.3);
        $this->fpdf->SetFont('', 'B');

        // Header  
        $w = array(35,80,40,40,40,40,61);

        $this->fpdf->Ln();

        //border LRTB
        $this->fpdf->Cell(5);
        $this->fpdf->Cell(90,10,'NAME',1,0,'C', 'LR');
        $this->fpdf->Cell(60,10,'ACCOUNT NUMBER',1,0,'C', 'LR');
        $this->fpdf->Cell(60,10,'ADDRESS',1,0,'C', 'LR');
        $this->fpdf->Cell(60,10,'BIRTHDAY',1,0,'C', 'LR');
        $this->fpdf->Cell(60,10,'CONTACT NO.',1,0,'C', 'LR');
        $this->fpdf->Ln(10);

        // Color and font restoration
        $this->fpdf->SetFillColor(224, 235, 255);
        $this->fpdf->SetTextColor(0);
        $this->fpdf->SetFont('');

        $fill = 0;
        //data
        foreach($data as $empsItem)
        {      
            $this->fpdf->Cell(5);
            $this->fpdf->Cell(90,10,$empsItem->name,1,0,'C',$fill);
            $this->fpdf->Cell(60,10,$empsItem->account_no,1,0,'C',$fill);
            $this->fpdf->Cell(60,10,$empsItem->address,1,0,'C',$fill);
            $this->fpdf->Cell(60,10,$empsItem->birthday,1,0,'C',$fill);
            $this->fpdf->Cell(60,10,$empsItem->contact_no,1,0,'C',$fill);
            $this->fpdf->Ln(10);
            $fill=!$fill;  
        }

        $this->fpdf->Ln(30);
        $this->fpdf->SetFont('Arial','B',10);
        $this->fpdf->Cell(20, 5,'Total Employees: '.$row->num_rows(), '', 0, 'LR', 0);

        $this->fpdf->SetY(184);
        $this->fpdf->SetFont('Arial','I',8);
        $this->fpdf->Cell(0,10,'Copyright. All Rights Reserved',0,0,'C');
        $this->fpdf->Cell(0,10,'Page '.$this->fpdf->PageNo().' of {nb}',0,0,'C');

        $this->fpdf->Output('Employee Report.pdf','I');
    }

Quote:This is my model:

Code:
public function load_data_employees()
      {
                 $query = $this->db->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;
      }

Quote:Config.php

Code:
$config['fonts_path']= "./system/fonts/font/";

that's the details.. PLS.. help me sir.. I badly need your response.. I tried to fix this but still, there no output.. Sad

BTW THANKS in advance! GODBLESS! Smile


Messages In This Thread
Generate PDF using FPDF library: Blank Output/Page - by El Forum - 09-27-2012, 08:46 AM
Generate PDF using FPDF library: Blank Output/Page - by El Forum - 09-27-2012, 09:31 AM
Generate PDF using FPDF library: Blank Output/Page - by El Forum - 09-27-2012, 10:19 AM
Generate PDF using FPDF library: Blank Output/Page - by El Forum - 09-28-2012, 09:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB