I'm dynamically loading HTML from a database, then formatting it and printing it to paper. Many times, the page break is in the middle of a DIV or other container element. How can I format my output so that it doesn't do that?
Asked
Active
Viewed 407 times
2 Answers
1
You will need to create a print stylesheet with a media query to target only print devices. There is a subset of CSS which can be used to style printed media. You can find detailed syntax help here.

Community
- 1
- 1

Seth Ficke
- 26
- 1
0
the answer was CSS
page-break-inside: avoid;
used like this:
<div style="page-break-inside: avoid;">
text goes here
</div>

Shawn
- 3,031
- 4
- 26
- 53