[...] Since the inputPos array generated by liblouis is now accurate, it can be used to find the print word corresponding to the last word that does not fit on a line.
Clever thinking! For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com