Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]object not found
#6

[eluser]smilie[/eluser]
Hi,

Here is the basis, you make it work :-)

Code:
class pdf_test extends Controller {

    function pdf_test()
    {
        parent::Controller();
    }

    function tcpdf()
    {
        $this->load->library('pdf');

        // set document information
        $this->pdf->SetSubject('TCPDF Tutorial');
        $this->pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        
        // set font
        $this->pdf->SetFont('times', 'BI', 16);
        
        // add a page
        $this->pdf->AddPage();
        
        # Load model which will get data from database
        $this->load->model('your_model');
        $pdf_data = $this->your_model->getData();
        // print a line using Cell()
        # $this->pdf->Cell(0, 12, 'Example 001 - €à èéìòù', 1, 1, 'C');
        $this->pdf->Cell(0, 12, $pdf_data, 1, 1, 'C');
        
        //Close and output PDF document
        $this->pdf->Output('example_001.pdf', 'I');        
    }
}

your_model.php (which should be in directory models :-))

Code:
Class Your_model extends Model
{
    function getData()
    {
       $this->db->select('some_field')->from('some_table')->where('some_search_field','search this');
       $q = $this->db->get();
       $result = $q->result_array();
       return $result;
    }
}


Messages In This Thread
[SOLVED]object not found - by El Forum - 12-01-2010, 01:27 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 02:07 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 03:09 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 03:37 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 03:42 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 04:02 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 04:29 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 04:31 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 04:39 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 04:43 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 05:08 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 05:09 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 05:12 AM
[SOLVED]object not found - by El Forum - 12-01-2010, 05:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB