troubleshooting Question

Unable to stream pdf: headers already sent

Avatar of AHMED SAMY
AHMED SAMYFlag for Egypt asked on
6 Comments1 Solution2845 ViewsLast Modified:
Unable to stream pdf: headers already sent

i use dompdf to create pdf

and this my code
// Include autoloader
require_once 'dompdf/';
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';


// 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");

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

// Render the HTML as PDF

// Output the generated PDF (1 = download and 0 = preview)
Paul Smart
Senior Support Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros