2013-07-03 17 views
1

DOMPDF笨,我試圖使2個HTMLS我得到錯誤的渲染DOMPDF笨,我試圖使2個HTMLS我得到錯誤的渲染

這裏的時候,我運行發生錯誤的第二渲染

[Wed Jul 03 09:18:10 2013] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'No block-level parent found. Not good.' in /var/www/onplans/application/libraries/dompdf/include/inline_positioner.cls.php:38\nStack trace:\n#0 /var/www/onplans/application/libraries/dompdf/include/frame_decorator.cls.php(546): Inline_Positioner->position()\n#1 /var/www/onplans/application/libraries/dompdf/include/inline_frame_reflower.cls.php(37): Frame_Decorator->position()\n#2 /var/www/onplans/application/libraries/dompdf/include/frame_decorator.cls.php(556): Inline_Frame_Reflower->reflow(NULL)\n#3 /var/www/onplans/application/libraries/dompdf/include/page_frame_reflower.cls.php(138): Frame_Decorator->reflow()\n#4 /var/www/onplans/application/libraries/dompdf/include/frame_decorator.cls.php(556): Page_Frame_Reflower->reflow(NULL)\n#5 /var/www/onplans/application/libraries/dompdf/include/dompdf.cls.php(817): Frame_Decorator->reflow()\n#6 /var/www/onplans/application/controllers/timeline.php(957): DOMPDF->render()\n#7 [internal function]: Timeline->generate_report_ in /var/www/onplans/application/libraries/dompdf/include/inline_positioner.cls.php on line 38, referer: 


if ($reportCouvs[0] == 1) { 
    // $this->pdf->load_html('reports/report_comb_1', $Ddata); 
    $this->pdf->load_view('reports/report_comb_1', $Ddata); 
    $this->pdf->render(); 
    $pdfoutput = $this->pdf->output(); 
    $filename = "$report_dir/"."cover3.pdf"; 
    $fp = fopen($filename, "a"); 
    fwrite($fp, $pdfoutput); 
    fclose($fp); 
    $this->pdf->load_view('reports/report_comb_2', $Ddata); 
    $this->pdf->render(); 
    $pdfoutputu = $this->pdf->output(); 
    $filenameu = "$report_dir/"."imagleft3.pdf"; 
    $fp = fopen($filenameu, "a"); 
    fwrite($fp, $pdfoutputu); 
    fclose($fp); 

} else if($reportCouvs[0] == 2) { 
    $this->pdf->load_view('reports/report_comb_2', $Ddata); 
} 

第二渲染應用程序崩潰

是可以渲染DOMPDF

+0

致命錯誤:未捕獲的異常「DOMPDF_Exception」有消息「未發現的塊級父。不好。' –

+1

運行第二個渲染時發生這種情況 –

+0

您嘗試渲染的HTML是什麼?有人說PHP必須啓用多字節擴展。它在主機上啓用了嗎? – Rolice

回答

1

我碰到了這個問題,人的兩個文件所以。 發生此錯誤的原因有幾個。有三個選項,您可以檢查:

  • 重新安裝DOMPDF庫
  • 確保MBSTRING安裝/配置/啓用PHP
  • 確保您重新初始化,或創建DOMPDF的新實例循環時。

因爲聽起來您已經成功輸出了一個PDF,這表明前兩個選項可能不是問題。我們無法看到與該問題有關的完整代碼,但似乎可能是第三種選擇。

如果是第三個,那麼你將確保創建PDF文件開始與線循環:

$this->pdf = new DOMPDF(); 
相關問題