Tcpdf Error: Some Data Has Already Been Output, Can't Send Pdf File

using html2pdf i got the error “TCPDF ERROR: Some data has already been output, can’t send PDF file” in my linux server.

in local server its working.

got the solution

in the function Output() jus add the line ob_end_clean();




public function Output($name = '', $dest = false)

        {

            // close the pdf and clean up

            $this->_cleanUp();


            // if on debug mode

            if ($this->_debugActif) {

                $this->_DEBUG_add('Before output');

                $this->pdf->Close();

                exit;

            }


            // complete parameters

            if ($dest===false) $dest = 'I';

            if ($dest===true)  $dest = 'S';

            if ($dest==='')    $dest = 'I';

            if ($name=='')     $name='document.pdf';


            // clean up the destination

            $dest = strtoupper($dest);

            if (!in_array($dest, array('I', 'D', 'F', 'S', 'FI','FD'))) $dest = 'I';


            // the name must be a PDF name

            if (strtolower(substr($name, -4))!='.pdf') {

                throw new HTML2PDF_exception(0, 'The output document name "'.$name.'" is not a PDF name');

            }


            // call the output of TCPDF

			ob_end_clean(); //solved

            return $this->pdf->Output($name, $dest);

        }