我需要一起做两件事.与DOMPDF同时使用.
我需要一起做以下事情 – 这可能吗?
//print the pdf file to the screen for saving $dompdf->stream("pdf_filename_".rand(10,1000).".pdf",array("Attachment" => false)); //save the pdf file on the server file_put_contents('/home/stsnew/public_html/pdf/file.pdf',$dompdf->output());
如果$dompdf-> stream和$dompdf-> output()分别/单独完成,上面的工作正常,但是当我尝试如上所示一起运行它们时,它只会崩溃.
任何帮助/建议将非常感激.
为什么不交换它们首先创建pdf作为文件,然后将创建的文件流回来?
原文链接:https://www.f2er.com/php/135653.html$file_to_save = '/home/stsnew/public_html/pdf/file.pdf'; //save the pdf file on the server file_put_contents($file_to_save,$dompdf->output()); //print the pdf file to the screen for saving header('Content-type: application/pdf'); header('Content-Disposition: inline; filename="file.pdf"'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($file_to_save)); header('Accept-Ranges: bytes'); readfile($file_to_save);