print to a new page

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

print to a new page

Post by shiznatix »

i have a page created by querys and it echos everything out then forces a print (all works well) but i want to be able to after each query is echoed out to put in somthing to force the printer to start printing on a new piece of paper, how is this done?
User avatar
wwwapu
Forum Contributor
Posts: 197
Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland

Post by wwwapu »

CSS Paged media, page-breaks and such might be the answer.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

have any examples because everything i found on google didnt work.
User avatar
wwwapu
Forum Contributor
Posts: 197
Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland

Post by wwwapu »

This works even with IE

Code: Select all

<style>
@media print{
	p{
		page-break-after: always;
	}
}
</style>
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

ok i tried that and did

Code: Select all

foreach($_POST[checked] as $key => $value)
    {
        show_cv($value, '2');
        echo '<p>';
    }
the foreach looped twice so it printed both cv's on the 1st page then printed 2 extra blank pages afterward. any other ideas?
User avatar
wwwapu
Forum Contributor
Posts: 197
Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland

Post by wwwapu »

maybe

Code: Select all

foreach($_POST[checked] as $key => $value){
  echo '<p>'
  show_cv($value, '2');
  echo '</p>'; 
}
??

page-break-after creates page break after elements ending. You could set it for <div>'s if you like. Or page-break-before for <h1> and other headings.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

works, many thanks
Post Reply