Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

divide page in pdf with page break using php

$itemCount = 0;
foreach ( $invoice['InvoiceDetail'] as $key=>$item){
    $itemCount++;
    $html .= '<tr style="border-bottom: 1px solid #ccc; line-height: 15px;">';

        /* snip */

        if ($itemCount % 20 == 0) {
            $html .= '<tr><td><div style="page-break-before: always;"></div></td></tr>';
        }

        $html .= '<td style="text-align: left"><h5>'.$itemNo.'</h5></td>';
        $html .= '<td style="text-align: left">'.$itemName.'</td>';
        $html .= '<td style="text-align: left">'.$price.'</td>';
        $html .= '<td style="text-align: left" width="10px">'.$quantity.'</td>';
        $html .= '<td style="text-align: right">'.$total.'</td>';

    $html .= '</tr>';
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #divide #page #pdf #page #break #php
ADD COMMENT
Topic
Name
6+9 =