我正在尝试将文件合并到一个 pdf 中。文件可以是 pdf、png 或 jpg 文件。图像工作正常,只有当我尝试导出 pdf 文件时才会出错。错误如下所示。
Message: fseek(): stream does not support seeking
我以为我从各种论坛中找到了与文件路径相关的解决方案。但是,如果我更改路径,则会显示此错误
mPDF error: Cannot open http://192.168.2.35/marine/certificate_files/a025ad3d40b22ac760ba7af7b6bb259d.pdf
我的控制器代码如下
include('mpdf/mpdf.php');
$mpdf=new mPDF();
$mpdf->SetImportUse();
$mpdf->SetFooter($personnel_data->firstname . ' ' . $personnel_data->lastname . '|{PAGENO}|' . $personnel_data->ID_number );
foreach($certificate_data as $certificates)
{
$certificate_extension['type'] = explode('.',$certificates->certificate_name);
if($certificate_extension['type'][1]==='pdf')
{
$pagecount = @$mpdf->SetSourceFile('http://192.168.2.35/marine/certificate_files/' . $certificates->certificate_name);
$tplId = $mpdf->ImportPage($pagecount);
$mpdf->UseTemplate($tplId);
$mpdf->WriteHTML('<pagebreak>');
}
if($certificate_extension['type'][1]!=='pdf')
{
$mpdf->WriteHTML('<p><img src="' . $this->config->base_url('assets/images/header-logo.png') . ' "></p>');
$mpdf->WriteHTML('<style>body {font-family: arial;}</style>');
$mpdf->WriteHTML('<p> ' . $certificates->certificate . ' - ' . $certificates->expiry_dates . '</p>');
$mpdf->WriteHTML('<p><img src="' . $this->config->base_url('certificate_files/' . $certificates->certificate_name) . ' "></p>');
$mpdf->WriteHTML('<pagebreak>');
}
else
{
$mpdf->WriteHTML('');
}
}
$mpdf->Output();
exit;
如果有任何帮助或指导可以让我从任何人那里溜走,我将永远感激不尽!谢谢!