I found this function in my collection. It takes a text range--for example, the tab before the page number--and calculates its width. If it's smaller than a certain threshhold, then you can do something like break the line.
function getTextRangeWidth (textRange, doc) {
var PT, prop, beginOffset, endOffset;
PT = 65536; // 1 point.
prop = doc.GetTextPropVal (textRange.beg, Constants.FP_LocX);
beginOffset = prop.propVal.ival / PT;
prop = doc.GetTextPropVal (textRange.end, Constants.FP_LocX);
endOffset = prop.propVal.ival / PT;
return endOffset - beginOffset;
}
... View more