我正在使用 TCPDF 生成 PDF,但在使用事务时出现以下错误:TCPDF 错误:空字体系列
我有以下代码片段(带有分页交易):
$titleDesc = $sPDFQuestion;
$pageNum = $this->pdf->PageNo();
$this->pdf->startTransaction();
$this->pdf->Bookmark($sPDFQuestion, 1, 0);
$this->pdf->titleintopdf($pdfTitle, $sPDFQuestion);
if($pageNum != $this->pdf->PageNo()){
$this->pdf->rollbackTransaction(false);
$this->pdf->AddPage('P', 'A4');
$this->pdf->Bookmark($sPDFQuestion, 1, 0);
$this->pdf->titleintopdf($pdfTitle, $sPDFQuestion);
}
else {
$this->pdf->commitTransaction();
}
这是 titleintopdf() 函数:
public function titleintopdf($title, $description = '')
{
if (!empty($title)) {
$title = $this->delete_html($title);
$oldsize = $this->FontSizePt;
$this->SetFontSize($oldsize + 4);
$this->Line(5, $this->y, ($this->w - 5), $this->y);
$this->ln(3);
$this->MultiCell('', '', $title, '', 'C', 0);
$this->MultiCell('', '', "Number:".$this->PageNo(), '', 'C', 0);
if (!empty($description) && isset($description)) {
$description = $this->delete_html($description);
$this->ln(7);
$this->SetFontSize($oldsize + 2);
$this->MultiCell('', '', $description, '', 'C', 0);
$this->ln(2);
} else {
$this->ln(4);
}
$this->MultiCell('', '', "Number:".$this->PageNo(), '', 'C', 0);
$this->Line(5, $this->y, ($this->w - 5), $this->y);
$this->ln(5);
$this->SetFontSize($oldsize);
}
}
当我不回滚事务而我只是提交它时,一切正常。我不知道为什么会发生此错误。你知道可能是什么问题吗?
慕姐8265434