$checkInfoList = self::getInfoList($order);
$pdf = new \TCPDF('L','mm','A3');
$pdf->SetPrintHeader(false);//去掉上下的横线
$pdf->SetPrintFooter(false);
$pdf->SetMargins(10, 0, 10, 0);
$pdf->AddPage();
$rowWidth = $width = $pdf->GetPageWidth() - 20;
$height = $pdf->getPageHeight();//高度
$pdf->setFont('stsong','',10);//设置字体与字体大小
$pdf->Cell($width,12,'审核时间:' . ($order['check_time'] ?date('Y-m-d H:i:s',$order['check_time']) :''),0,1);写入数据
$pdf->Line(10,40,$width - 10,40);//画横线
$sectionWidth = $rowWidth / 3;
//一行分成三等份
$pdf->Cell($sectionWidth,10,'姓名:' . $patient['name'],0,0,'L');
$pdf->Cell($sectionWidth,10,'送检机构:' ,0,0,'L');
$pdf->Cell($sectionWidth,10,'样本类型:' ,0,1,'L');
$pLineStartY = $pdf->GetY();//竖线开始的Y轴
$footStartY = $height - 60;//底部开始
//画竖线
$pdf->Line($width/2,$pLineStartY,$width/2,$footStartY);
//水印图片
$pdf->Image($watermarkImg, $watermarkX, $watermarkY, $watermarkWidth, $watermarkHeight, '', '', '', false, $opacity);
$pdf->Output($filePath, 'F');
php使用TCPDF生成PDF 的基本用法
最新推荐文章于 2024-06-22 14:09:30 发布