ERROR: Unable to stream pdf

4,914 views
Skip to first unread message

febie

unread,
Jul 14, 2009, 9:21:58 AM7/14/09
to dompdf
Good Day,

anyone can help me determine why i get this error : " Unable to
stream pdf: headers already sent " ?? should i put the code at the
top for generating the pdf ??? anyone have an idea on this.. please
help me.. thanks a lot


-febie ( ^ - ^ )

febie

unread,
Jul 16, 2009, 7:03:59 AM7/16/09
to dompdf
up.. please help me..tnx

psychoactive

unread,
Jul 16, 2009, 11:03:58 AM7/16/09
to dompdf
Hello! Try to check the php on the page you are using to load the html
document and make there there are no spaces at all before or after the
php tags or it will cause that error.

Jacob

unread,
Jul 17, 2009, 4:43:58 PM7/17/09
to dompdf
I got this error whenever I echo'ed something before generating the
PDF document. Try removing all unnecessary code from your php code.

Helmut Tischer

unread,
Jul 18, 2009, 7:56:37 AM7/18/09
to dom...@googlegroups.com
>> > > anyone can help me determine why i get this error : " Unable to
>> > > stream pdf: headers already sent " ?? should i put the code at the

Make sure that after the last closing tag ?> at the end of a php file
there is no invisible white space, or even better, remove the ?> at
the end completely.
This is a frequent source of grief.

Reason: a php file starts and ends in html mode, and such white space
is treated as html output.

See
http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php

(I don't talk about obvious unmotivated print* and echo instructions
in the source which are also procucing this effect)

Helmut

febie

unread,
Jul 20, 2009, 8:16:37 AM7/20/09
to dompdf
Thank u all for your reply.. i do all what u say and nothing change
its still say "Unable to stream pdf: headers already sent"

It's possible that the cause of this problem is the redirection of
page.??

Example:( base on what i do)

The main folder "C:\xampp\htdocs\agentrepository"

The first file that being executed is the MODULE31.PHP located in the
main folder then in that php file their is a code that will include
the ASSIGN_EMPLOYEE_TO_COURSE.PHP that is the page were i put the pdf
code which located in "C:\xampp\htdocs\agentrepository\views
\Module31\ASSIGN_EMPLOYEE_TO_COURSE.PHP"

What i want to do is "their is a certain view then a submit button on
the bottom if i click the EXPORT TO PDF button it will produce a PDF
copy of that view or page" and i suspect that causing the problem the
"redirect" thing..

i badly need ur help for suggestion or solution to my problem.. i hope
i can solve this problem with ur help guys.. tnx a lot :-)

--febie



On Jul 18, 7:56 am, Helmut Tischer <htisc...@weihenstephan.org> wrote:
> >> > >   anyone can help me determine why i get this error : " Unable to
> >> > > stream pdf: headers already sent " ??  should i put the code at the
>
> Make sure that after the last closing tag ?> at the end of a php file
> there is no invisible white space, or even better, remove the ?> at
> the end completely.
> This is a frequent source of grief.
>
> Reason: a php file starts and ends in html mode, and such white space
> is treated as html output.
>
> Seehttp://www.php.net/manual/en/language.basic-syntax.instruction-separa...

therocksha

unread,
Jul 20, 2009, 9:41:59 AM7/20/09
to dompdf


Hey Febie,

$pdf->stream() must be called before any actual output is sent, either
by normal HTML tags, blank lines in a file, or from PHP.

You must make sure that nothing is printed in the screen before the
stream is called

not even html tags. It is just like calling the header() function.

refer http://in2.php.net/manual/en/function.header.php

Ollie

unread,
Aug 9, 2014, 5:10:02 AM8/9/14
to dom...@googlegroups.com
Hey folks,
looks as I am going mad. I am using a dompdf generator, which works fine in my xampp enviroment.
Just uploaded the staff. Now I got an "Unable to stream pdf: headers already sent"-error??
is there anything special I have to tune e.g. the apache?
Best
Oliver

John Bell

unread,
Aug 9, 2014, 6:32:48 AM8/9/14
to dom...@googlegroups.com
Headers already sent means that some output has already been sent from the PHP program.

A common cause of this is whitespace outside the <?php   ... ?> delimiters. Best practice is not to have a closing ?> at the end of any file to avoid trailing whitespace.

A good writeup is here: https://www.drupal.org/node/1424

Regards

John
--
You received this message because you are subscribed to the Google Groups "dompdf" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dompdf+un...@googlegroups.com.
To post to this group, send email to dom...@googlegroups.com.
Visit this group at http://groups.google.com/group/dompdf.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages