Link to home
Start Free TrialLog in
Avatar of AHMED SAMY
AHMED SAMYFlag 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

Avatar of Paul Smart
Paul Smart
Flag of United Kingdom of Great Britain and Northern Ireland image

What version of dompdf?

Try...

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

ASKER

i tried it not good i need to output data dynamic
What version?
i removed it , can you give me link or method to export a dynamic php page with images
pease
ASKER CERTIFIED SOLUTION
Avatar of Paul Smart
Paul Smart
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok thanks i will tryit now