Set page break based on size of paper

We have a query running that is automatically emailed to staff. Everything works well until we print. Is there a way to force page breaks to every 8 inches?

Can't do the page break always or before or after as some rows are longer than others.
BHUCAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

F IgorDeveloperCommented:
Using css you can set a page-break using style:
And then put a tag with class "pagebreak" in every place you want:

<style>
@media print {
    .pagebreak {page-break-after: always;}
}
</style>

<body>
<p>
Page 1 content
...
</p>
<div class=pagebreak ></div>
<p>
Page2 content
...
</p>
</body>

Open in new window



or simply using a tag with style instead of class:

<div style="page-break-after: always;" ></div>

Open in new window

BHUCAuthor Commented:
Fraigor - page break always doesn't work as the amount of rows pulled from the query will be different. Break won't be in the same spot each time.
F IgorDeveloperCommented:
If you are trying to avoid rows in a table to be broken by an automatic page break,
you can configure the page break at row-level, so always a cell is printed in one page without breakin it in multiple pages (unless a row cannot be printed in only one page)


<style type="text/css">
@media print {
   table { 
     page-break-inside:auto 
   };

   tr    { 
    display: block;
    page-break-inside:avoid; 
    page-break-after:auto 
   };

  }

</style>

Open in new window

test.html

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.