0

I the below codeigniter code i am working on pdf file when i execute it hello world is only displaying but not the tables pls help me to solve the issue.I have placed the controller below.I download from this site http://www.christophermonnat.com/2008/08/generating-pdf-files-using-codeigniter/

Controller:

<?php

class Tutorial extends controller
{

    function Tutorial()
    {
        parent::Controller();

        $this->load->helper('url');
    }


    function index() 
    {   
        $this->hello_world();
    }


    function hello_world()
    {
        $this->load->library('cezpdf');

        $this->cezpdf->ezText('Hello World', 12, array('justification' => 'center'));
        $this->cezpdf->ezSetDy(-10);

        $content = 'The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog.
                    Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs.';

        $this->cezpdf->ezText($content, 10);

        $this->cezpdf->ezStream();
    }


    function tables()
    {
        $this->load->library('cezpdf');

        $db_data[] = array('name' => 'Jon Doe', 'phone' => '111-222-3333', 'email' => 'jdoe@someplace.com');
        $db_data[] = array('name' => 'Jane Doe', 'phone' => '222-333-4444', 'email' => 'jane.doe@something.com');
        $db_data[] = array('name' => 'Jon Smith', 'phone' => '333-444-5555', 'email' => 'jsmith@someplacepsecial.com');

        $col_names = array(
            'name' => 'Name',
            'phone' => 'Phone Number',
            'email' => 'E-mail Address'
        );

        $this->cezpdf->ezTable($table_data, $col_names, 'Contact List', array('width'=>550));
        $this->cezpdf->ezStream();
    }


    function headers()
    {
        $this->load->library('cezpdf');
        $this->load->helper('pdf');

        prep_pdf(); // creates the footer for the document we are creating.

        $db_data[] = array('name' => 'Jon Doe', 'phone' => '111-222-3333', 'email' => 'jdoe@someplace.com');
        $db_data[] = array('name' => 'Jane Doe', 'phone' => '222-333-4444', 'email' => 'jane.doe@something.com');
        $db_data[] = array('name' => 'Jon Smith', 'phone' => '333-444-5555', 'email' => 'jsmith@someplacepsecial.com');

        $col_names = array(
            'name' => 'Name',
            'phone' => 'Phone Number',
            'email' => 'E-mail Address'
        );

        $this->cezpdf->ezTable($db_data, $col_names, 'Contact List', array('width'=>550));
        $this->cezpdf->ezStream();
    }

}

?>
4

2 に答える 2