I have an extbase extension where I have a createPdfAction in which I create a PDF from the current view.
looks kinda like this:
$html = $this->view->render();
$dompdf->setPaper('A4', 'portrait');
$dompdf->loadHtml(utf8_decode($html));
$dompdf->render();
$dompdf->stream($this->clearString('filename.pdf');
exit;
Works great, but if i set the FE compressionLevel e.g. to 5 in the install tool - the PDF File which is created is now corrupt and can't be opened.
I even tried to turn off the compression by dompdf itself:
$dompdf->stream($this->clearString('filename.pdf',array("compress" => 0));
But that also didn't work
dompdf 0.8.0
TYPO3 8.7.1
php 7
Thanks to Jost:
Adding header('Content-Encoding: gzip')
fixes the problem.