1

I have a HTML document with many tables which I want to be printed. The problem is that sometimes, the paper end is reached in the middle of a row, so half of it is printed in one page and the rest in the next page, even cutting a single line of text in two parts.

Is there any way to avoid this?

NOTE: I have already read this question, but I need a solution which not involves CSS, because is not working at the target computer, and I can't change that.

Community
  • 1
  • 1
Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207

2 Answers2

3

Even with CSS, the issue is difficult due to limited browser support to CSS pagination (as can be seen from the answers to the question you refer to).

Through years, this problem has existed, and I don't think anyone has souped up an HTML trick for the purpose. There have been some tricks for trying to prevent page breaks inside a paragraph or list by placing it in a one-cell table, but this has worked occasionally only, and besides, in your case you already have a table.

So I’m afraid there is no solution, apart from using elements that cause extra vertical spacing, like a pre element containing empty lines (to push the entire table to next page—this may of course make things much worse when the parameters of the situation, like page formatting and paper size, differ from your expectations) or splitting a table into two tables, possibly with extra space between them (even more problematic).

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
2

If the target computer doesn't support (enough of) CSS, then you can create a PDF document on the server. If you set the Content-Type correctly, the browser will download the document and start the PDF reader of the system.

If this isn't possible, then there is no solution.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820