[eluser]ashbyrich[/eluser]
Trying to get this working on local dev server without much success. I have set upplug in and run controller as instructed in the wiki to no avail...
the controller
Code:
Class Pdftest extends Controller{
function Pdftest()
{
parent::Controller();
}
function index()
{
$this->load->plugin('to_pdf');
$data['gret']="hsghghsagdhgsajhdgsajh";
$html = $this->load->view('stuff',$data, true);
pdf_create($html, 'filename');
}
}
the view
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<h1>some stuff</h1>
<?=$gret ;?>
</body>
</html>
the plugin
Code:
if (!defined('BASEPATH')) exit('No direct script access allowed');
function pdf_create($html, $filename, $stream=TRUE)
{
require_once("dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
if ($stream) {
$dompdf->stream($filename.".pdf");
} else {
write_file("C:\$filename.pdf", $dompdf->output());
}
}
I am using php 5 and pdflib is enabled