$pdf = new Mpdf([
'tempDir' => app()->getRootPath() . '/public/temp'
]);
// 设置左、上、右的间距
$pdf->SetMargins('10', '10', '10');
// 设置是否自动分页 距离底部多少距离时分页
$pdf->SetAutoPageBreak(TRUE, '15');
//开启字段文字和样式
$pdf->autoScriptToLang = true;
$pdf->autoLangToFont = true;
$pdf->AddPage();
// 设置字体
$pdf->SetFont('stsongstdlight', '', 14, '', true);
$fild_path = getDirPath(app()->getRootPath() . '/public/uploads/contract/');
$filename = $fild_path . $this['user_id'] . '.pdf';
$pdf->WriteHTML($this['contract_content']);
$pdf->Output($filename);
$contract_pdf = base_url() . 'uploads/contract/'. $this['user_id'] . '.pdf';
$this->save(['contract_pdf' => $contract_pdf]);
return $contract_pdf;
富文本生成PDF
最新推荐文章于 2024-07-18 15:24:52 发布