Page 1 of 1

print to a new page

Posted: Thu May 19, 2005 11:39 am
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?

Posted: Fri May 20, 2005 12:31 am
by wwwapu
CSS Paged media, page-breaks and such might be the answer.

Posted: Fri May 20, 2005 5:08 am
by shiznatix
have any examples because everything i found on google didnt work.

Posted: Fri May 20, 2005 5:53 am
by wwwapu
This works even with IE

Code: Select all

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

Posted: Fri May 20, 2005 6:56 am
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?

Posted: Fri May 20, 2005 7:18 am
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.

Posted: Fri May 20, 2005 8:00 am
by shiznatix
works, many thanks