I'm trying to go through the code of TCPDF to understand how it calculates the height of the text to be rendered, but it's too much for me to handle without asking.
What I want to know: in the PDF from example 5 http://www.tcpdf.org/examples/example_005.pdf it gives the cell a yellow background. I'm guessing that at the basic level, it first draws a box with this fill color, then adds the text, so what method is it calling to get the height of the text to know the height of the box to fill?
I can see from the example code that MultiCell()
is the entry point, but it's not clear what's the method it calls to get the height of the text. I pasted the code for MultiCell()
in this pastebin
http://pastebin.com/A1niGrQG
Anyone knows how to trace this, because doing it by hand and looking through the code isn't working at all for me.
TCPDF (at least the latest version) includes the method getStringHeight()
which get the estimated height needed for printing a simple text string using the Multicell()
method.
Additionally, the getNumLines()
method gives you the estimatad number of lines.
Check the source code documentation at http://www.tcpdf.org for further information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With