Unable to stream pdf: headers already sent

Unable to stream pdf: headers already sent

i use dompdf to create pdf

and this my code
// Include autoloader
require_once 'dompdf/autoload.inc.php';
require_once 'dompdf/lib/php-font-lib/src/FontLib/Autoloader.php';
require_once 'dompdf/lib/php-svg-lib/src/autoload.php';
require_once 'dompdf/lib/html5lib/Parser.php';


$folder='http://11111111/pdfs';
$pdfid=$resultpackages['package_id'];


// Reference the Dompdf namespace
use Dompdf\Dompdf;
use Dompdf\Options;

$options = new Options();
$options->set('defaultFont', 'Courier');
$dompdf = new Dompdf($options);

// Instantiate and use the dompdf class
$dompdf = new Dompdf();

// Load content from html file
$html = file_get_contents("http://********.com/pdf.php");
$dompdf->loadHtml($html);

// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');

// Render the HTML as PDF
$dompdf->render();

// Output the generated PDF (1 = download and 0 = preview)
$dompdf->stream("package",array("Attachment"=>0));

Open in new window

AHMED SAMYownerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Paul SmartSenior Support EngineerCommented:
What version of dompdf?

Try...

// Output the generated PDF to Browser
$dompdf->stream();
?>
0
AHMED SAMYownerAuthor Commented:
i tried it not good i need to output data dynamic
0
Paul SmartSenior Support EngineerCommented:
What version?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

AHMED SAMYownerAuthor Commented:
i removed it , can you give me link or method to export a dynamic php page with images
pease
0
Paul SmartSenior Support EngineerCommented:
Try tcpdf
Of the pdf php creators out there this one is brilliant.
Very flexible and without knowing the exact project behind your requirements this should work well.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AHMED SAMYownerAuthor Commented:
ok thanks i will tryit now
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.