• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Integrating R&OS PDF generator in CI

#1
[eluser]andreagam[/eluser]
Hi. After a long search I decided to pick R&OS PDF generation classes and try to integrate it into CI.
I know, it's sooo far from being perfect, but being stuck to PHP4 I couldn't find anything better...

Unfortunately, I'm still a first-timer OO coder and I don't find it easy to understand the necessary steps to integrate such classes and make a CI library or what else out of it.

Does anybody want to help me and release a solution (hopefully useful to the community...)?


Well, that's what I did.
Downloaded the classes athttp://www.ros.co.nz.pdf, unzippd and I got:
- class.pdf.php
- class.ezpdf.php
- fonts folder
- readme.php (which actually calls the classes to produce the pdf file)
- data.txt (a text file with the content to be pdf'd)

I followed Danfreak advice and created a folder "my_classes" into the Application folder.
Then I put into "my_classes" the 'class' files and the fonts folder.

I added the 'ini_set' thing into the index.php file to make CI load the folder 'my_classes' (see this link).

Am I doing right till now? Well, now I took a controller 'page' and
added a function 'createpdf'.

Code:
function createpdf()
{                
require_once("class.ezpdf.php");
    $pdf =& new Cezpdf();
    $pdf->selectFont('./fonts/Helvetica.afm');
    $pdf->ezText('Hello World!',50);
    $pdf->ezStream();
}

The $pdf lines are taken from a doc example.
I get as output a text page which notifies an undefined index error.
in the class.pdf.php file, on line 1934.

Anybody willing to help me?

I'd really appreciate any help. Thanks a lot.

#2
[eluser]Phil Sturgeon[/eluser]
Might want to look into the "creating your own libraries" stuff. Includes often get messed up in the libraries folder for me though, so I try to remove as many includes as possible or put them elsewhere. Put this in your normal libraries folder and try:

Code:
function createpdf()
{                
$this->load->library("ezpdf");

    $this->ezpdf->selectFont('./fonts/Helvetica.afm');
    $this->ezpdf->ezText('Hello World!',50);
    $this->ezpdf->ezStream();
}

That worked for me when I was using this rubbish class.

#3
[eluser]andreagam[/eluser]
Thanks a lot for your answer, thepyromaniac.
It works for me too!
You saved my day.

Thanks again for lending a hand.

#4
[eluser]garrisonian[/eluser]
How can i draw boxes ?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.