8

I need to print multiple pages and footer needs to be print in last page bottom. I have add css for footer like this

footer {
     display: block;
     width:100%;        
     position:absolute;
     left:0;
     bottom:0px;        
}

Issue is footer is printing first page, but i need this on last page.

laaposto
  • 11,835
  • 15
  • 54
  • 71
Nikesh Ponnen
  • 399
  • 1
  • 2
  • 10

1 Answers1

0

Include a stylesheet with your custom style for footer for print using media="print" as

<link rel="stylesheet" href="yourpath/footerstyle.css" media="print"/>

or

embed styles as in html

<style>
@media print {
   footer {
    display: block;
    width:100%;        
    position:absolute;
    left:0;
    bottom:0;        
   }
}
</style>

or

<style type="text/css" media="print">
    footer {
        display: block;
        width:100%;        
        position:absolute;
        left:0;
        bottom:0;         
    }
</style>

Try to position the body relative and the footer absolute:

<style type="text/css" media="print">
     body {
        position: relative;
     }
     footer {
        display: block;
        width:100%;        
        position:absolute;
        left:0;
        bottom:0;         
     }
</style>

or you could use something like this:

@page:last {
    @bottom-center {
        content: "…";
    }
}

CSS 3 Paged Media module

Edit

<style type="text/css" media="print">
     body {
        position: relative;
        margin: 0;
     }
     .page-section {

        /* Specify physical size of page, margins may vary by browser */

        height: 10 in; /* or give size as per proper calculation of the height of all your pages after which you want footer */
        position: relative;
     }
     footer {
        display: block;
        width:100%;        
        position:absolute;
        left:0;
        bottom:0;         
     }
</style>

add .page-section to relevant div / divs as per you want divs to print per page or directly add to body tag.

4dgaurav
  • 11,360
  • 4
  • 32
  • 59