【问题标题】:Error while creating a PDF using DOMPDF使用 DOMPDF 创建 PDF 时出错
【发布时间】:2015-06-21 07:21:34
【问题描述】:

我正在使用DOMPDF version (0.6 beta)。我收到以下错误:

Fatal error: Call to a member function append_child() on null in C:\xampp\htdocs\practice\application\helpers\dompdf\include\frame_tree.cls.php on line 220

这是我的代码 sn-p:

$this->load->helper(array('dompdf', 'file'));
$quoteId = $this->uri->segment('4');
$filename ='ship-'.uniqid().'.pdf';
$data = pdf_create($html, '', false);

$html = file_get_contents(BASE_URL.'index.php/admin/quotes/createQuotePDF/'.$quoteId);

在过去的 4 个小时里,我一直被这个错误困扰。 也无法从 Google 获得太多帮助。我们将不胜感激

【问题讨论】:

  • 在您的代码 sn-p 中,变量 $html 的声明位于函数调用 pdf_create 之后。声明必须在函数调用之前完成,否则变量将保持未定义并导致错误。

标签: javascript php jquery pdf dompdf


【解决方案1】:

我意识到我犯了什么错误。我包含了太多它无法处理的样式。然后用最少的内联样式实现,它就像一个魅力

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 2017-08-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多