我需要从GS获取stdout并将其与PHP一起使用以从HTML页面呈现PDF。
这是我从GS中选择的方式:
gs -sOutputFile=%stdout -q | lpr
这是我使用fopen
阅读文件并使用fpassthru
显示其内容的方式:
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Content-Type: '.mime_content_type($filepath));
header('Content-Length: '.filesize($filepath));
header('Content-Disposition: attachment; filename="NameOfTheFile.pdf";');
fpassthru(fopen($filepath,'rb'));
fclose($f);
感谢。