load->library('pdf'); foreach ($tpl as $value) { $ci->load->view($value, $data); $html = $ci->output->get_output(); $ci->dompdf->loadHtml($html); // setup size $ci->dompdf->setPaper('A4', 'portrait'); // Render the HTML as PDF } // _die($html); // Get output html // add external css library // $html .= ''; // Load pdf library $ci->dompdf->render(); // echo $output = $ci->dompdf->output(); // Output PDF (1 = download and 0 = preview) $ci->dompdf->stream($name, array("Attachment" => 0)); } ?>