Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

page breaks when printing 3

Status
Not open for further replies.

joelmac

Programmer
Jun 4, 2002
92
CA
Hi there,

Is there a tag or a css thing that, when printing, will cause the printer to start a new page? ________________________
JoelMac
 
I'm afraid I've never heard of such a thing. Printer page-break is exclusively from the world of print and web pages are, well, not.

If you yourself are trying to do it, then I might suggest using a word processor and then pasting screenshots into it.

If, however, you want to force a Client box to do this, it's going to be a real trick.

That said, here's a dippy idea that might do it:

If I wanted to force a page break, I'd reason that I'd want to force the browser to print my content as two separate documents, as paper control is pretty much nonexistent in the world of the web. So, I would appropriately divide my content up such that each "section" appeared in a different one of stacked frames. There would be no visible border, so it would all appear as a seamless page, but there would be three different frames there.

Now the tricky part. Can I, when the browser tries to print the page, tell it to print Frame_01, then print Frame_02, then print Frame_03. Sequentially?

That's what I would explore.

Cheers,

Edward "Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
yeah i figgured it would have to be something like that, that might work all right. I though I saw somewhere, when reading about css, something to do with printing, but I don't remember where now, oh well.

Thanks for the help. ________________________
JoelMac
 
<style>p page-break-before:always}</style>

Is this what you mean? I used the p tag but you can use other tags and you can use different options, like after instead of before. Look at one of the online css sites for options if you need them. Clive
 
thanks man, that works great!

Another question for ya, Is there a way to rotate a table 90 degrees and print it, or basicly print some pages landscaped and some pages normal all from the same web page.
________________________
JoelMac
 
If your table contains text you might try experimenting with something I saw in another thread.

<html><head>
<style>
.flip {writing-mode: tb-rl; filter: fliph flipv}
</style></head>
<body><table border=&quot;1&quot;>
<tr><td class=&quot;flip&quot;>This is my text</td></tr>
</table></body></html>
Clive
 
Hey, that's awesome!!

I got another one for ya. What about removing the page headers and footers when printed? The URL, title, and date, but leave the page numbers. Can we do that?

where are you getting your information? Is there someplace I can go and look it up myself?

Thanks

________________________
JoelMac
 
In IE use the menu item File/Page-setup to remove headers and footers.

There is a lot of good stuff on this site but I have found the search a bit buggy and the search is limited to the last 6 months. Clive
 
ahem.. scuse me guys..

back to the page breaks.. can i ask some advice?

I am creating an html report which pops up in its own page

My goal is to somehow detect the length of the report to allow the next page to print the column headers again.

Question: Any great ideas here about how i can do that (if i can)??

Comment: I tried (just to see if it worked) the following between records:
<div style=&quot;page-break-before: always;&quot;>
Then printed my report. I got the title on the first page, then 9 blank pages before all rows printed on the last page. yuck. Any comments about that?


 
Tracy, Here is a better solution:

<html><head>
<style media=&quot;print&quot;>
.hdr{display:inline;}
</style>
<style media=&quot;screen&quot;>
.hdr{display:none;}
</style></head>
<body>
<div style=&quot;page-break-before:always&quot; class=&quot;hdr&quot;>My Header</div>
</body>
</html>

As far as your printing problem you can do a page preview instead of a print to see how it will work and this might help you track down the problem. Clive
 
hmm.. that didnt work,

guess it should be pointed out that my report is held within a table...column headers are held within <th>
and my program loops through records to display the records in <tr><td>

I dont want to break every row, or even every Item's records, as they still may fit on one page. BUT if they dont, i need the values in <th> repeated at the TOP of the NEXT page. Possible??
 
try
<thead style=&quot;&quot;display:table-header-group;&quot;&quot;>
<tr>
<th>Header</th>
</tr>
<tbody>
<tr>
<td>Rest of page</td>
</tr>

when you print or print preview it will display the header at the top of all the pages
 
sorry. that should be
<thead style=&quot;display:table-header-group;&quot;>
 
Try this for landscape printing:

<style media=&quot;print&quot;>
body {size: landscape;}
</style>

Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top