Created
February 1, 2024 15:51
-
-
Save susanBuck/0c907c4d42fa217251f8bc9e163e1da0 to your computer and use it in GitHub Desktop.
Fix for Dompdf downloading instead of streaming to the browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
Fix for Dompdf downloading instead of streaming to the browser | |
⭐ Video guide: https://youtu.be/ktOoBDSFTgI ⭐ | |
**/ | |
require 'vendor/autoload.php'; | |
use Dompdf\Dompdf; | |
$dompdf = new Dompdf(); | |
$dompdf->loadHtml('<h1>hello world</h1>'); | |
$dompdf->render(); | |
# Before 😔 | |
#$dompdf->stream(); | |
# After 😀 | |
$dompdf->stream("", ["Attachment" => false]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment