Tuesday, May 23, 2017

Print Page doesn't break properly on second page

I am trying out a layout in the table print preview when as I notice it doesn't break properly in the second page even though I am using page-break-after: always; see my code then the screen of the output below

CSS declaration

    div.page
          {
            page-break-after: always;
            page-break-inside: avoid;
          }
.footer{
       position:fixed;
       bottom:-10px;
       height:32px;
    }

The footer

<hr class="footer" style="width:100%;height:5px;bottom:20px;background-color:black !important;">
<div class="footer"><img width="120px" height="20px" src="/logo.png"></div>
<div class="footer" style="right:20px"></div>
<div style="left:330px" class="footer" id="dateTime"></div>

The table

 <div class="page"><!--page css here-->
    <h2 id="heading">CHEMICAL TEST</h2>
    <p id="heading"></p>
    <p id="heading">Report No.: RN001</p>
    <hr>
    <center>
    <p id="heading"></p>
    <th>Username</th>
    <th>Name</th>
    <th>Data Calculation</th>
    <th>Status</th>
    <th>Date</th>

    @foreach($reportData as $data)
    <tr>
      <td> <br> </td>
      <td></td>
      <td></td>
      @if($data['method_status'] == 0)
      <td>Inactive</td>
      @else
      <td>Active</td>
      @endif
      <td> <br>  </td>
    </tr>
  @endforeach
    </table>
  <p id="totalresult_dtab">Total : </p>
    </div>
  </center>
</div>

The first page is breaking correctly but after that it's not.

See the first page of the output. enter image description here

Second page that is not breaking properly enter image description here

Can you help me how to break it properly?



via user827391012

Advertisement