I am using TCPDF Library to get PDF Downloadable. I have to pass retrieved data through loops to single vaiable as:
$tcpdf->writeHTML($html, true, false, true, false, '');
I have to pass these values to $html varibable:
$html = '<h1>'.'Order Number: '.$OrderId.'<br />Customer Name: '.$customerName.'<br />Item Name: '.$itemName.'</h1>';
but I have multiple records and have to pass this information many time through loops.
This is the table I want to pass from template to $html variable(PDF object):
<h2 align ="center" bgcolor ="#75777a">Order Pick List</h2>
<table>
<tr>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
</tr>
<?php $Orders= $block->getOrders();
foreach ($Orders as $order) {
$Colone = $order->getID();
$Coltwo = $order->getName();
$items = $order->getitems();?>
<tr>
<td><?php echo $Colone; ?></td>
<td><?php echo $Coltwo; ?></td>
<?php foreach ($items as $item ) {
$itemName = $item->getitemName();?>
<td>
<?php echo $itemName; ?>
</td>
<?php } ?>
</tr>
<?php}
?>
Any help should be appreciated.