I am using dompdf for generating pdf in codeigniter application, When I am opening pdf its giving error
I checked all stackoverflow stuffs for this,
and more,but no luck, my code is :
$html = file_get_contents(base_url() . "sampleHTMLfilepath");
require_once("dompdf/dompdf_config.inc.php");
if (is_null($this->_dompdf)) {
$this->_dompdf = new DOMPDF();
}
$this->_dompdf->load_html($html);
$this->_dompdf->render();
$this->_dompdf->stream('test.pdf);
sample html is simple file with p tag
<p>Hello </p>
Please help me, Thanks
no one should be down voting this question. anyway try something like this in your controller method, convert for your use.
// get some content
$data['order'] = $this->printmodel->getOrder();
// Load a view like you would normally do
$this->load->view('orderprint', $data);
// before going any further,
// make sure the content is showing on the view with no errors
// when you call the method
// all good? ok now add this part
// Get the output html
$html = $this->output->get_output();
// Load library
$this->load->library('dompdf_gen');
// Create pdf name based on date, hour, seconds
$pdfname = date("FjYgias");
// Convert to PDF
// (this is for streaming the pdf directly)
$this->dompdf->load_html($html);
$this->dompdf->render();
$this->dompdf->stream($pdfname);
and this is a much more complicated example then what you are trying to do - you don't have to call a model, etc - you can just call the view,
$this->load->view('somethingcooltoprint');
confirm its working and then do the rest of the code like above.