Jump to content

TCPDF ERROR: Some data has already been output to browser, can't send PDF file


Recommended Posts

  • 4 weeks later...

I've got this problem yesterday. In my website with 2 language translation. But in my case this error gone after I've change template to older one or default. (I'm trying to translate PDF invoice to my language) I'm very curious about this and start to compare the old template and my newer template until I found that the problem came from a folder "pdf" in my theme.

 

then I delete these folder:

/shop/themes/themename/pdf

/shop/themes/themename/pdf/lang

Link to comment
Share on other sites

  • 4 weeks later...

Hello

 

For those who will need it

I had the same problem with PS1.5.2

 

the solution is to add

ob_clean(); in the render function in \classes\pdf\PDFGenerator.php on line 129

 public function render($filename, $display = true)
{
 if (empty($filename))
  throw new PrestaShopException('Missing filename.');
 $this->lastPage();
 $output = $display ? 'I' : 'S';
 ob_clean();
 return $this->output($filename, $output);
}

 

SEEu

  • Like 4
Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...
  • 1 month later...

The problem happens when I try to view an Invoice of an Order.

It generates these errors:
 

Strict Standards: Declaration of Tools::displayDate() should be compatible with that of ToolsCore::displayDate() in /home/carringt/public_html/flowershop/override/classes/tools.php on line 24

Notice: Use of undefined constant _RIJNDAEL_KEY_ - assumed '_RIJNDAEL_KEY_' in /home/carringt/public_html/flowershop/classes/Cookie.php on line 80

Notice: Use of undefined constant _RIJNDAEL_IV_ - assumed '_RIJNDAEL_IV_' in /home/carringt/public_html/flowershop/classes/Cookie.php on line 80

Warning: Missing argument 2 for Tools::displayDate(), called in /home/carringt/public_html/flowershop/classes/pdf/HTMLTemplateInvoice.php on line 42 and defined in /home/carringt/public_html/flowershop/override/classes/tools.php on line 9

Notice: ob_clean() [ref.outcontrol]: failed to delete buffer. No buffer to delete. in /home/carringt/public_html/flowershop/classes/pdf/PDFGenerator.php on line 173

Warning: Cannot modify header information - headers already sent by (output started at /home/carringt/public_html/flowershop/override/classes/tools.php:24) in /home/carringt/public_html/flowershop/tools/tcpdf/tcpdf.php on line 8961
TCPDF ERROR: Some data has already been output to browser, can't send PDF file



All I can do is look in the files I don't know how to fix them.

Link to comment
Share on other sites

  • 8 months later...

This error is caused because there is a line in your code that is generating a PHP Notice or warning which is being output as the response. TCPDF cannot continue because there is already a response.

 

You need to fix the errors in your code and get rid of the warnings & notices.

 

Or if you just want to hide them, as tuk66 mentioned, that should work too.

Link to comment
Share on other sites

  • 6 months later...
  • 2 months later...

io ho lo stesso problema:

TCPDF ERROR: Some data has already been output, can't send PDF file

 

Fino ad oggi ha funzionato correttamente adesso non più.

Il modulo installato si chiamata Modulo Product to PDF Simple

il modulo l'ho acquistato su http://addons.prestashop.com

e il suo sviluppatore è: invertus

 

Io uso la versione di prestashop 1.5.4.1

 

 

Qualcuno mi sa dire cosa è successo e come rimediare?

Grazie.

Link to comment
Share on other sites

×
×
  • Create New...