Php Wkhtmltopdf提供了一个未捕获的异常
我正在尝试wkhtmltopdf,以便将我的数据下载到pdf,并在下面得到一个错误 任何帮助都将不胜感激Php Wkhtmltopdf提供了一个未捕获的异常,php,html,codeigniter,pdf,wkhtmltopdf,Php,Html,Codeigniter,Pdf,Wkhtmltopdf,我正在尝试wkhtmltopdf,以便将我的数据下载到pdf,并在下面得到一个错误 任何帮助都将不胜感激 An uncaught Exception was encountered Type: Exception Message: System error Loading pages (1/6) [> ] 0% [======>
An uncaught Exception was encountered
Type: Exception
Message: System error
Loading pages (1/6)
[> ] 0%
[======> ] 10%
[=======> ] 12%
Warning: SSL error ignored
[========> ] 14%
[=========> ] 16%
[==========> ] 18%
[============> ] 20%
[=============> ] 23%
[===============> ] 25%
[================> ] 27%
[=================> ] 29%
[==================> ] 31%
[===================> ] 33%
[=====================> ] 35%
[======================> ] 38%
[========================> ] 40%
[=========================> ] 43%
[===========================> ] 45%
[============================> ] 47%
[=============================> ] 49%
[=====================================> ] 63%
[==========================================> ] 70%
[=============================================> ] 76%
[=================================================> ] 83%
[============================================================] 100%
Counting pages (2/6)
[============================================================] Object 1 of 1
Resolving links (4/6)
[============================================================] Object 1 of 1
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[==============================> ] Page 1 of 2
[============================================================] Page 2 of 2
Done
Filename: application/libraries/Wkhtmltopdf.php
Line Number: 866
Backtrace:
File: /var/www/admin/index.php
Line: 315
Function: require_once
下面是我的PHP codeigniter文件中的一行代码,它将发送错误,以防有帮助:
$html = $this->load->view('report/view_course_summary_pdf', $data, true);
$pdfFilePath = "Course_Summary_Report.pdf";
$options['path'] = $myPath;
$options['orientation'] = 'Landscape';
$options['commandOptions'] =
array(
'useExec' => true, // Can help if generation fails without a useful error message
'procEnv' => array(
// Check the output of 'locale' on your system to find supported languages
'LANG' => "'" . $this->session->userdata('lang_code') . "_US.utf-8" . "'",
)
);
$this->load->library('wkhtmltopdf', $options);
$this->wkhtmltopdf->setTitle($this->common_lang->get_lang_token('course_summary_report'));
$this->wkhtmltopdf->setOptions(['ignoreWarnings' => true]);
$this->wkhtmltopdf->setHtml($html); // $html can be a url or html content.
$this->wkhtmltopdf->output(Wkhtmltopdf::MODE_DOWNLOAD, $pdfFilePath);
很多人讨论了与使用WKPDF和SSL相关的类似问题,但我不认为这会导致我的问题,因为它说SSL错误被忽略了。。。任何帮助都将不胜感激。每当我尝试这样做时,我的HTML都会被下载,但使用上面的Codeginter代码它的格式已损坏。尝试将设置
'ignoreWarnings'=>true,
添加到commandOptions,例如$options['commandOptions']=array('ignoreWarnings'=>true,'useExec'=>true,//如果生成失败而没有有用的错误消息'procev'=>array(//检查系统上'locale'的输出,以查找支持的语言'LANG'=>“'”。$this->session->userdata('LANG_代码'))。“_US.utf-8”。”;