Gary
Gary

Reputation: 297

Print a page angularJS

i would like to print a given page with angulaJS, so a did this simple solution:

<div class="modal fade" id="extrait" aria-hidden="true" data-backdrop="false">
        <table class="table table-hover table-bordered" id="tab1">   
             <thead>
                <tr class="row-name" >
                   <th >Banque</th>
                   <th>N. Cheque</th>
                   <th>Montant</th>
                </tr>      
             </thead>   
             <tbody>
                <tr class="row-content"  ng-repeat="cl in extraits">          
                        <td>{{cl.nomBanque}}</td>
                        <td>{{cl.numCheque}}</td>
                        <td>{{cl.montant}}</td>             
                </tr>       
             </tbody>
        </table>  
        <div class="btn-group" role="group">            
       <button id="btnPrint" class="btn btn-info btn-block" ng-click="print()">Print</button> 
       </div>
 </div>


    <script>
        $scope.print=function(){        
                            $window.print();                
                };
    </script>

It works, but when i have a long list to print, so it print only one page, and the scrollbar appear. Iould like to print pag 1, page 2 .... Can you have any suggestion please. Thanks.

Upvotes: 1

Views: 82

Answers (1)

Lotus91
Lotus91

Reputation: 1125

You could use css3 media queries for printing as follow:

@media print {
  body, html, #wrapper {
      width: 100%;
  }
}

Or you could use a separate css file and use percentage values as below:

<link rel="stylesheet" href="css/print.css" type="text/css" media="print"/>

print.css :

body, html, #wrapper {
width: 100%;
}

Upvotes: 1

Related Questions