simple way to create html page to pdf using dompdf
your library of dom pdf
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter PDF Library
*
* Generate PDF's in your CodeIgniter applications.
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author Chris Harvey
* @license MIT License
* @link https://github.com/chrisnharvey/CodeIgniter-PDF-Generator-Library
*/
require_once(dirname(__FILE__) . '/dompdf/dompdf_config.inc.php');
class Pdf extends DOMPDF
{
/**
* Get an instance of CodeIgniter
*
* @access protected
* @return void
*/
protected function ci()
{
return get_instance();
}
/**
* Load a CodeIgniter view into domPDF
*
* @access public
* @param string $view The view to load
* @param array $data The view data
* @return void
*/
public function load_view($view, $data = array())
{
$html = $this->ci()->load->view($view, $data, TRUE);
$this->load_html($html);
}
}
you can download the dompdf folder
put int to the library folder
https://github.com/dompdf/dompdf
controller like this call
$data['etc_data'] = $this->model->data($id);
$data['evn_etc_data'] = $this->model->ext_data($id);
$this->load->view('pdf',$data);
$this->load->view('pdf',$data);
$this->load->library('pdf');
$this->pdf->load_view('pdf',$data);
$this->pdf->render();
$this->pdf->stream("test.pdf");
your view like this
<?php print_r($etc_data);?>
<?php print_r($evn_etc_data);?>
//here write your html code and your logic
other wise you can see this link implement based helper
https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf