php - TCPDF - loop data in two columns layout -


im using tcpdf, @ moment im listing data in 2 columns using array_chunk works fine. need data show in first columns , second, see below:

currently:     1   2     3   4     5   6     7   8     9   10 should be:     1   6     2   7     3   8     4   9     5   10 

this code:

<?php   $array = range(1, 50);?> <table nobr="true" cellpadding="2">      <?php foreach (array_chunk($array, 2) $a) { ?>         <tr>         <?php foreach ($a $array_chunk) { ?>            <td><?php echo $array_chunk; ?></td>             <?php          } ?>        </tr>        <?php }    ?> </table> 

my second query(complex) if there more 30 rows need able use $pdf->addpage(); , continues on next page.

tcpdf - support multicolumns, wat used solve issue:

$pdf->addpage(); $pdf->resetcolumns(); $pdf->setequalcolumns(2, 84);  // key part -  number of cols , width $pdf->selectcolumn();                $content =' loop content here'; $pdf->writehtml($content, true, false, true, false); $pdf->resetcolumns() 

the code add auto page break , continues next page.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -