php - Saving generated pdf directly to a folder folder - Codeigniter -
i generate , send created pdf folder error, error :
a php error encountered severity: warning message: file_put_contents(http://localhost/nqcl1/workbooks/ndqa000000001/ndqa000000001.pdf) [function.file-put-contents]: failed open stream: http wrapper not support writeable connections filename: libraries/dompdf_lib.php line number: 13
dompdf_lib.php //library file
class dompdf_lib extends dompdf{ function createpdf($html, $filename='', $stream=true){ $this->load_html($html); $this->render(); $this->set_paper('a4', 'potratit'); if ($stream) { //$this->stream($filename.".pdf"); - works ok file_put_contents(base_url().'workbooks/s'.$filename.'/'.$filename.".pdf", $this->output()); } else { return $this->output(); } } }
coa.php //controller
function generatecoadraft($labref,$offset=0) { // error_reporting(1); $data['labref'] = $labref = $this->uri->segment(3); $data['information'] = $this->getrequestinformation($labref); $data['tests_requested'] = $this->getrequestedtests($labref); $data['trd'] = $this->getrequestedtestsdisplay2($labref); $data['compedia_specification'] = $this->getcoabody($labref); $html = $this->load->view('coa_v', $data, true); $this->dompdf_lib->createpdf($html, $labref); }
this line works fine if use instead of file_put...., if stream=false, return blank page
$this->stream($filename.".pdf");
file_put_contents native php function, change line to;
file_put_contents('workbooks/s'.$filename.'/'.$filename.".pdf", $this->output());
by prepending $this-> system trying find function belongs class (which doesn't exist), hence error.
Comments
Post a Comment