This question has been raised hundred of times in various fora; some have been solved, some not. I checked plenty of resources, but my issue could not be resolved. I am gene
simple solution :
write below lines before stream, it will show where exactly new line or space is coming
$f;
$l;
if(headers_sent($f,$l))
{
echo $f,'<br/>',$l,'<br/>';
die('now detect line');
}
for me - solution was to encode my file to UTF-8 instead of UTF-8 BOM
Replace line 3105 of this file: dompdf/lib/class.pdf.php
if ( headers_sent()) {
die("Unable to stream pdf: headers already sent");
}
With
$output = ob_get_clean();
if ( headers_sent()) {
echo $output; }
Then in the file that is generating the pdf output e.g if you were outputting from a Joomla Component components/com_joomlacomponent/views/yourpdfdir/tmpl/default.php Enter immediately after the opening php tag
<?php
ob_start();
In my case the problem was solved by setting $_dompdf_show_warnings to false in dompdf_config_inc.php
I had this issue, with no apparent output when viewing the source. The problem for me was that I had flushed the output, even though there was none except the headers, and that blocked streaming the output giving the "headers already sent" message. Which was true. My fix was to remove the flush() and ob_flush() statements, and the streaming output then worked.
i have the same problem, and i solved this problem with add this code in the top file :
ob_start();
Good luck dude!