[eluser]heenji[/eluser]
you could try this steps:
copy phprtflite's lib content to CI application/librarys/PHPRtfLite,
create a PHPRTFLITE.php in application/librarys,it content like following:
Code:
<?php
if (!defined('BASEPATH')) {exit('No direct script access allowed');}
class CI_PHPRTFLITE
{
/**
* Constructor
*
* @param string $class class name
*/
function __construct($class = NULL)
{
ini_set('include_path',
ini_get('include_path') . PATH_SEPARATOR . APPPATH . 'libraries/PHPRtfLite');
if ($class)
{
require_once (string) $class . EXT;
log_message('debug', "PHPRtfLite Class $class Loaded");
}
else
{
log_message('debug', "PHPRtfLite Class Initialized");
}
}
/**
* PHPRtfLite Class Loader
*
* @param string $class class name
*/
function load($class)
{
require_once (string) $class . EXT;
log_message('debug', "PHPRtfLite Class $class Loaded");
}
}
?>
make a controller and method like this:
Code:
public function testrtf(){
$this->load->library('phprtflite');
$this->phprtflite->load('PHPRtfLite/PHPRtfLite');
PHPRtfLite::registerAutoloader();
$rtf = new PHPRtfLite();
$sect = $rtf->addSection();
$sect->writeText('<i>hello<b>world</b></i>.', new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER));
// save rtf document
$rtf->save('hello.rtf');
echo 'create ok,and download <a href="'.base_url().'hello.rtf">here</a>';
}