使用ezpdf转换为pdf到pdf?

时间:2015-05-21 09:06:32

标签: php codeigniter pdf ezpdf

我想使用codeigniter中的ezPDF创建一个简单的pdf。我正在关注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();
    }
}

我在应用目录中的Cezpdf.phpCpdf.php文件夹中复制了/application/librariesfonts。现在我收到此错误:

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:

我该如何解决这个问题?任何帮助将不胜感激..

1 个答案:

答案 0 :(得分:0)

他们使用了Hello World但你使用Hello作为类名,请查看他们的文章

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

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