2016-06-13 103 views
1

我有這樣的代碼,試圖生成報告爲PDF:laravel-DOMPDF返回錯誤,代碼不行

$details=array(
    'id'=>$find->id, 
    'full_letter_title'=>$find->full_letter_title, 
    'smarok_no'=>$find->smarok_no 
); 
$data['details']=$details; 


$pdf = PDF::loadView('letter.view', $data); 
return $pdf->stream(); 

但它返回錯誤

ErrorException in Adobe_Font_Metrics.php line 42: fopen(C:\xampp\htdocs\ams\storage\fonts/ba50cf37c0b6d75f8275d2b44106f606.ufm): failed to open stream: No such file or directory 

我無法理解什麼是錯在這裏。

+0

給出一個合適的文件夾路徑來生成pdf。 –

+0

我寫了這個,但沒有工作@Kaushalshah $ pdf = PDF :: loadView('app/resources/views/letter/view.blade.php',$ data); –

+0

我認爲這個鏈接可能會幫助你http://stackoverflow.com/questions/35606120/dompdf-failed-to-generate-pdf-from-simple-html-bootstrap –

回答

0

這將通過在存儲文件夾內創建字體目錄來解決。這用於存儲臨時文件。但無論如何Dompdf不是PDF的有效庫。我已經使用這個,並得到更多關於路線的CSS問題。我建議你使用Phanthomjs PDF。 https://github.com/danielboendergaard/phantom-pdf它比DomPDF好得多。

0

STEPS

  1. 箱「字體」文件夾中存儲
  2. 創建文件「5ab413ede0c0d14abbb48febee3bfdfb.ufm」或其他「文件名」裏面「字體」錯誤,顯示文件夾
  3. 給予許可「字體」 文件夾

現在它的運行

[參考](https://github.com/barryvdh/laravel-dompdf/issues/269