<body style="height: 100%;" onload="window.print();">
So this is my code in PHP, I then echo the html but it only prints the first page. All solutions that I've found say that I should put the height/width to 100% but it is still not working.
already tried
body, html, #wrapper { width: 100%;
height:100%;
}
@media print { ... }
this is the print page body you can see the foreach that's why in some cases it's longer than one page.
why this is happening ?
<body onload="window.print();">
<div class="wrapper">
<section class="invoice">
<!-- title row -->
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
'.$company_info['company_name'].'
<small class="pull-right">Date: '.$order_date.'</small>
</h2>
</div>
<!-- /.col -->
</div>
<!-- info row -->
<div class="row invoice-info">
<div class="col-xs-12 ">
<b>'.$this->lang->line('orderno').':</b> '.$order_data['bill_no'].'<br>
<b>'.$this->lang->line('customername').':</b> '.$name['customer_name'].'<br>
<b>'.$this->lang->line('customeradress').':</b> '.$name['customer_address'].' <br />
<b>'.$this->lang->line('customerphonenumber').':</b> '.$name['customer_phone'].'
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</br>
<!-- Table row -->
<div class="row">
<div class="col-xs-12 table-responsive">
<table class="table table-striped">
<thead>
<tr style="border:1px">
<th colspan="2"></th>
<th style="text-align:center" colspan="2">'.$this->lang->line('qty').'</th>
<th colspan="6"></th>
</tr>
<tr>
<th>'.$this->lang->line('productname').'</th>
<th>'.$this->lang->line('price').'</th>
<th>Commandée</th>
<th>à Livrer</th>
<th>'.$this->lang->line('vat').'</th>
<th>'.$this->lang->line('discount').'</th>
<th>'.$this->lang->line('amount').'</th>
</tr>
</thead>
<tbody>';
foreach ($orders_items as $k => $v) {
$product_data = $this->model_products->getProductData($v['product_id']);
setlocale(LC_MONETARY, 'en_US');
$html .= '<tr>
<td>'.$product_data['name'].'</td>
<td>'.number_format($v['rate'], 3).'</td>
<td>'.$v['qty'].'</td>
<td>'.$v['qty_liv'].'</td>
<td>'.$v['vat'].' %</td>
<td>'.$v['discount'].' %</td>
<td>'.number_format($v['amount'], 3).'</td>
</tr>';
if($v['free'] > 0){
$html .= '<tr>
<td>'.$product_data['name'].'</td>
<td>0</td>
<td>0</td>
<td>'.$v['free'].'</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>';
}
}
$html .= '</tbody>
</table>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-6 pull pull-right">
<div class="table-responsive">
<table class="table">
<tr>
<th style="width:50%">'.$this->lang->line('grossamount').':</th>
<td>'.$order_data['gross_amount'].'</td>
</tr>';
$html .= '<tr>
<th>'.$this->lang->line('totalvat').':</th>
<td>'.$order_data['total_vat'].'</td>
</tr>';
$html .='
<tr>
<th>'.$this->lang->line('netamount').':</th>
<td>'.$order_data['net_amount'].'</td>
</tr>
<tr>
<th>'.$this->lang->line('status').':</th>
<td>'.$confiem_status.'</td>
</tr>
</table>
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
</body>
in some cases the foreach goes for more then a page so..