0
I am using dompdf, I need to download the file automatically, how to do this?
I’m using the code below:
$dompdf = new DOMPDF ();
$dompdf->load_html($resultado[0]['recibo']);
$dompdf->render();
$dompdf->stream("Recibo.pdf", array("Attachment" => true));
It was to open the dialog to save the file, but I’m getting the following error:
Unable to stream pdf: headers already sent
Pq?
"headers already sent" means that there is something before your DOMPDF that is being sent together in the download, maybe an echo, a print, or even HTML. In other words, DOMPDF has to be executed on a page that does not have any other content, such as HTML or text, only DOMPDF itself.
– Guilherme Nascimento
Any alternative to DOMPDF? Ta fuck use it here.
– Linces Marques
It is not the fault of DOMPDF and you will not be able to solve the problem using another lib, read: https://answall.com/a/18812/3635
– Guilherme Nascimento
I decided to take a $_GET that passed empty
– Linces Marques
Yes, $_GET should issue a Warning before the Location header, then the error, text or HTML content before the DOMPDF and Location header.
– Guilherme Nascimento