I actually had to do something similar to what your looking for a couple of weeks again.
For it to work tho you must use courrier character ( from what i understand they are the only for which each character has the same height but im not sure)
finding height of multiLine textbox when it expands on multiple pages
for (var i = 0; xfa.layout.h(txt_CompteRendu, "pt", i) > 0; i++) {
totLine = totLine + (xfa.layout.h(txt_CompteRendu, "pt", i) / 10);
}
Basically i take the height of the textbox "in pt but you could use mm / cm" and divide it by the height of my characters (in my case 10).
THe reason i put it in a for loop is because my textbox can grow on many pages, to access the textbox on each page you need to specify its index