Proloy
Proloy

Reputation: 363

Php to pdf conversion using ezpdf?

I wanted to create a simple pdf using the ezPDF in codeigniter. I am following this article. my controller code looks like this:

<?php
class Hello extends CI_Controller {
    function index()
    { 
        $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();
    }
}

I copied Cezpdf.php and Cpdf.php in the /application/libraries and the fonts folder in the app directory.so now i am getting this error:

A PHP Error was encountered

Severity: Error

Message: Call to a member function ezText() on a non-object

Filename: controllers/hello.php

Line Number: 6

Backtrace:

How can i fix this??? any help would be appreciated..

Upvotes: 0

Views: 1392

Answers (1)

Gopi Nathan
Gopi Nathan

Reputation: 123

They have used Hello World but you are using Hello as class name please check with their article

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

http://christophermonnat.com/blog/generating-pdf-files-using-codeigniter

Upvotes: 0

Related Questions