Avatar of AHMED SAMY
AHMED SAMY
Flag for Egypt asked on

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

PHP

Avatar of undefined
Last Comment
AHMED SAMY

8/22/2022 - Mon
Paul Smart

What version of dompdf?

Try...

// Output the generated PDF to Browser
$dompdf->stream();
?>
AHMED SAMY

ASKER
i tried it not good i need to output data dynamic
Paul Smart

What version?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
AHMED SAMY

ASKER
i removed it , can you give me link or method to export a dynamic php page with images
pease
ASKER CERTIFIED SOLUTION
Paul Smart

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.
AHMED SAMY

ASKER
ok thanks i will tryit now