• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Getting error with DOMPDF on Codeigniter 2 + dompdf-0.5.2 El Forum Guest   04-09-2011, 01:05 AM [eluser]Unknown[/eluser] Hello dear friends. I am new here, this is my first post! I am trying to use the DOMPDF to generate PDF files, but i am getting an error. My script works like that: We get the data from the database, use a parser to parse the view model and output it to the PDF (as everyone do). My code: Code:$dados = array( 'nome' =>$nome,        'nome_guerra' => $nome_guerra );$this->load->helper('to_pdf');     $html =$this->parser->parse('relacoes/modelos/teste', $dados, TRUE); pdf_create($html, 'filename'); Of course the variables from $dados have been declared before The error i receive is: Fatal error: Uncaught exception 'PDFlibException' with message 'Cannot modify header information - headers already sent by (output started at C:\xampplite\htdocs\codeigniter\system\helpers\to_pdf_helper.php:18)' in C:\xampplite\htdocs\codeigniter\system\helpers\dompdf\include\pdflib_adapter.cls.php:833 Stack trace: #0 C:\xampplite\htdocs\codeigniter\system\helpers\dompdf\include\pdflib_adapter.cls.php(833): header('Cache-Control: ...') #1 C:\xampplite\htdocs\codeigniter\system\helpers\dompdf\include\dompdf.cls.php(447): PDFLib_Adapter->stream('filename.pdf', NULL) #2 C:\xampplite\htdocs\codeigniter\system\helpers\to_pdf_helper.php(11): DOMPDF->stream('filename.pdf') #3 C:\xampplite\htdocs\codeigniter\application\controllers\relacoes.php(80): pdf_create('Cad MUNI SAMBA ...', 'filename') #4 [internal function]: Relacoes->processar('1') #5 C:\xampplite\htdocs\codeigniter\system\core\CodeIgniter.php(325): call_user_func_array(Array, Array) #6 C:\xampplite\htdocs\codeigniter\index.php(198): require_once('C:\xampplite\ht...') # in C:\xampplite\htdocs\codeigniter\system\helpers\dompdf\include\pdflib_adapter.cls.php on line 833 ORIGINAL MESSAGE: Quote:Fatal error: Uncaught exception 'PDFlibException' with message 'Cannot modify header information - headers already sent by (output started at C:\xampplite\htdocs\codeigniter\system\helpers\to_pdf_helper.php:18)' in C:\xampplite\htdocs\codeigniter\system\helpers\dompdf\include\pdflib_adapter.cls.php:833 Stack trace: #0 C:\xampplite\htdocs\codeigniter\system\helpers\dompdf\include\pdflib_adapter.cls.php(833): header('Cache-Control: ...') #1 C:\xampplite\htdocs\codeigniter\system\helpers\dompdf\include\dompdf.cls.php(447): PDFLib_Adapter->stream('filename.pdf', NULL) #2 C:\xampplite\htdocs\codeigniter\system\helpers\to_pdf_helper.php(11): DOMPDF->stream('filename.pdf') #3 C:\xampplite\htdocs\codeigniter\application\controllers\relacoes.php(80): pdf_create('Cad MUNI SAMBA ...', 'filename') #4 [internal function]: Relacoes->processar('1') #5 C:\xampplite\htdocs\codeigniter\system\core\CodeIgniter.php(325): call_user_func_array(Array, Array) #6 C:\xampplite\htdocs\codeigniter\index.php(198): require_once('C:\xampplite\ht...') # in C:\xampplite\htdocs\codeigniter\system\helpers\dompdf\include\pdflib_adapter.cls.php on line 833 Has anyone experienced this kind of problem, and can anyone help with this, tell me what is hapening? Obs: I am using a local XAMPP server on Windows 7 Thank you very much. El Forum Guest 04-19-2012, 12:49 PM [eluser]Riley123[/eluser] I get an error too: Warning: require_once(/Applications/MAMP/htdocs/extranet/application/helpers/dompdf/include/ci_exceptions.cls.php) [function.require-once]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/extranet/application/helpers/dompdf/dompdf_config.inc.php on line 208 Fatal error: require_once() [function.require]: Failed opening required '/Applications/MAMP/htdocs/extranet/application/helpers/dompdf/include/ci_exceptions.cls.php' (include_path='.:/Applications/MAMP/bin/php/php5.3.6/lib/php') in /Applications/MAMP/htdocs/extranet/application/helpers/dompdf/dompdf_config.inc.php on line 208 No idea why. dompdf doesn't even have a file called ci_exceptions.cls.php El Forum Guest 04-19-2012, 11:06 PM [eluser]Ayeyermaw[/eluser] @Muni It appears that your helper "to_pdf_helper.php" has already output a header (possibly an error) prior to calling the dompdf output. That's where you need to start looking. Also as a side note. Do you really want to be putting custom helpers in the codeigniter system folder? You could have problems when you update future versions of codeigniter El Forum Guest 09-24-2012, 12:39 PM [eluser]Unknown[/eluser] @Riley123 Warning: require_once(/Applications/MAMP/htdocs/extranet/application/helpers/dompdf/include/ci_exceptions.cls.php) [function.require-once]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/extranet/application/helpers/dompdf/dompdf_config.inc.php on line 208 Fatal error: require_once() [function.require]: Failed opening required ‘/Applications/MAMP/htdocs/extranet/application/helpers/dompdf/include/ci_exceptions.cls.php’ (include_path=’.:/Applications/MAMP/bin/php/php5.3.6/lib/php’) in /Applications/MAMP/htdocs/extranet/application/helpers/dompdf/dompdf_config.inc.php on line 208 I have solved this problem by creating ci_exceptions.cls.php,an empty php file in that directory and i am not getting errors anymore.I dont know whether it is right way bt it is working well and not showing errors now El Forum Guest 09-24-2012, 01:40 PM [eluser]Shiju S S[/eluser] Quote:Remove ?> from the end of files Like: dompdf_helper,dompdf El Forum Guest 09-24-2012, 01:48 PM [eluser]Shiju S S[/eluser] Code:$this->load->helper(array('dompdf', 'file')); $data['title']='PDF Printing';$html=$this->load->view('viewfile_name',$data, true); pdf_create(\$html, 'filename'); Quote:?> at the end of controller files will be causing the modify header error.