How to determine text height when printing

theone69

Newcomer
Joined
Aug 10, 2006
Messages
2
Hello everybody!

I have a problem with which I've been struggling for the last couple of days. We have a web site with a lot of articles and have recently prepared a functionality for automatic conversion of the text to PDF. The conversion works fine, but there is a problem - the thing is that we should be able to control the page flow so that there wouldn't be any unwanted page breaks - that is because certain pieces of the content (eg. tables) should not break.

Our idea is to calculate the remaining height on the page and comparing it to the needed height. If the needed space is bigger than the space available we would insert manual page break.
Yet, as you may imagine we have problems how to determine text height. I have some experience with VB 6 where Printer.TextHeight method could be used, but don't know how to implement this type of functionality in ASP.NET (2.0). I have read about Graphics.DrawString method, but lack the experience to make it work.

Any ideas and suggestions on the subject would be most welcome. Or, a different solution maybe?

Thanks,
Bostjan
 
Back
Top