[英]How to write PrinceXML file to server using PHP
Trying to fwrite the pdf results from PrinceXML to the server (in a new pdf file) instead of exporting via headers to acrobat. 尝试从PrinceXML将pdf结果写到服务器(在新的pdf文件中),而不是通过标头导出到acrobat。 The below code displays the results on the browser.
以下代码在浏览器上显示结果。
require_once("../library/Prince/prince.php");
$princeSettings = $this->getInvokeArg('bootstrap') >getOption('prince');
$prince = new Prince($princeSettings['path']);
$prince->setHTML(true);
$result = $prince->convert_string_to_passthru($this->htmlView);
$fp = fopen("./files/reports/report.pdf", "w");
fwrite($fp, $result);
fclose($fp);
Figured this out for anyone who want to know... 想出任何想要知道的人...
require_once("../library/Prince/prince.php");
$princeSettings =$this->getInvokeArg('bootstrap')->getOption('prince');
$prince = new Prince($princeSettings['path']); $prince->setHTML(true);
$pdfPath =realpath(APPLICATION_PATH . "/../public/files/reports/report.pdf");
$prince->convert_string_to_file($this->htmlView, $pdfPath);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.