Printjob - why are there NO good examples?

I want to print text that is several pages long.
My text will be contained in a few scrollable tex boxes.

I’ve searched and searched and searched.
I can’t find ANY examples that will do what I need.
I would have thought that what I need is fairly fundamental and basic?

I do have a small complication though, my text will be HTML. Therefore some of the text can be a bigger size if it’s a header say for example.

Therefore, it’s not necessary good enough to count the number of lines of text.
(I think.)

Any pointer or suggestions or snippets of code would be really appreciated.

Thanks.

OM