DOMPDF: Unable to stream pdf: headers already sent

后端 未结 10 2298
夕颜
夕颜 2020-12-18 06:45

This question has been raised hundred of times in various fora; some have been solved, some not. I checked plenty of resources, but my issue could not be resolved. I am gene

10条回答
  •  太阳男子
    2020-12-18 07:16

    Replace line 3105 of this file: dompdf/lib/class.pdf.php

    if ( headers_sent()) {
      die("Unable to stream pdf: headers already sent");
    }
    

    With

    $output = ob_get_clean();
    if ( headers_sent()) {
        echo $output; }
    

    Then in the file that is generating the pdf output e.g if you were outputting from a Joomla Component components/com_joomlacomponent/views/yourpdfdir/tmpl/default.php Enter immediately after the opening php tag

提交回复
热议问题