2013-09-27 57 views
0

嘗試從PrinceXML將pdf結果寫入服務器(在一個新的pdf文件中),而不是通過頭文件導出到acrobat。下面的代碼在瀏覽器上顯示結果。如何使用PHP編寫PrinceXML文件到服務器

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); 

回答

0

想通了這一點誰想要認識的人......

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);