Welcome Guest, Not a member yet? Register   Sign In
DOMPDF with CI
#1

[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">

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
<h1>some stuff</h1>


&lt;?=$gret ;?&gt;
&lt;/body&gt;

&lt;/html&gt;

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




Theme © iAndrew 2016 - Forum software by © MyBB