php – 如何在TCPDF中计算MultiCell / writeHTMLCell的高度?

我尝试创建一个具有多个页面的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

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...