php – 如何在TCPDF中计算MultiCell / writeHTMLCell的高度?
发布时间:2020-12-13 14:06:16 所属栏目:PHP教程 来源:网络整理
导读:我尝试创建一个具有多个页面的PDF,并且需要提前计算每个单独元素(MultiCell)的高度来准备分页符.根据文档,有几个功能,像GetCharWidth / GetStringWidth支持我自己做,但除了潜在的性能损失,我可能不会这样做了.建议以更优雅的方式实现我的目标? 参考:TCPDF
我尝试创建一个具有多个页面的PDF,并且需要提前计算每个单独元素(MultiCell)的高度来准备分页符.根据文档,有几个功能,像GetCharWidth / GetStringWidth支持我自己做,但除了潜在的性能损失,我可能不会这样做了.建议以更优雅的方式实现我的目标?
参考:TCPDF
我GOT它:D !!!!!
创建另一个pdf2对象 // pdf2 set x margin to pdf1's xmargin,but y margin to zero // to make sure that pdf2 has identical settings,you can clone the object (after initializing the main pdf object) $pdf2 = clone $pdf; pdf2->addpage pdf2->writeCell $height = pdf2->getY() pdf2->deletePage(pdf2->getPage()) pdf1->checkPageBreak($height); pdf1->writeCell() W00tness:D (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |