Avatar of doctorbill
doctorbill
Flag for United Kingdom of Great Britain and Northern Ireland asked on

DOM pdf error

error when using dom pdf to generate pdf files from php records:
Error:
Unable to stream pdf: headers already sent

I have tried all the typical suggested solutions for this but I still get the error
I haven't posted any code yet because I am unsure of exactly what to post
I initially post this error in case anyone has a suggestion of whet the error is actually telling me / doing in terms of code
I am pretty sure it used to work on my server but I have not visited my code for some time so I just cannot remember if anything has changed
PDFPHPApache Web Server

Avatar of undefined
Last Comment
doctorbill

8/22/2022 - Mon
gr8gonzo

This is because you have code that is trying to set HTTP headers, but the HTTP headers have been sent already.

This is the same error as the PHP one:
Warning: Cannot modify header information - headers already sent

...which I cover in my article:
https://www.experts-exchange.com/articles/32160/How-to-Fix-Just-About-Every-Common-PHP-Error.html

Basically, ANY output at all, even a line break or a single space, will tell PHP / the web server that you're done with the headers portion of the response and you're moving onto the body of the response. So more often than not, this is just a line break somewhere in an included / required file.
doctorbill

ASKER
Attached files:

searchWorkformCompany.php
This file is the source file and the links "Create Individual PDF" sends "id2" data to the following page:

pdf_workformPDF.php
This file uses the dom pdf files and has the following file as an include:
searchWorkFormPDF.php

Can you see where the issues may be?
pdf_workformPDF.php
searchWorkformCompany.php
searchWorkFormPDF.php
ASKER CERTIFIED SOLUTION
Chris Stanyon

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
doctorbill

ASKER
Once again - thanks all
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23