Unable to stream pdf: headers already sent problem

6,153 views
Skip to first unread message

Surya Maya Lama

unread,
Jun 3, 2011, 7:15:02 AM6/3/11
to dompdf
Hi,
I am using dompdf for my wordpress project. It works perfectly in
local server and one of my live server. When I uploaded the project in
one of plesk controlled linux server, error message is displayed as
"Unable to stream pdf: headers already sent". I have used ob_start as
well.

Can anyone suggest the solution for this. Thanks in advance

BrianS

unread,
Jun 3, 2011, 3:01:12 PM6/3/11
to dom...@googlegroups.com

Typically this happens when you have PHP set to display errors to the web browser. In this case non-critical warnings will not prevent the PDF from being generated, but then DOMPDF won't be able to send it to the browser since the content-type headers will already have been set.

I would expect ob_start() to prevent this from happening. Perhaps you have some random space (such as a line break at the top of your file) present in your code before the ob_start() command.

SML

unread,
Jun 7, 2011, 10:59:53 PM6/7/11
to dompdf
Thank you BrianS.......I kept ob_start on the main page and it
worked ...

Barang KH

unread,
Sep 8, 2014, 2:37:44 AM9/8/14
to dom...@googlegroups.com
I would say it's 99% a problem with the format you are saving your files in. Some editors add what is called a BOM to the file which is ignored by most but PHP interprets it as output. It is also invisible so difficult to remove.

What editor are you using? Do a google on "remove BOM"
Reply all
Reply to author
Forward
0 new messages