Files
MYSOPHAL/lib/tcpdf/templates/article_qr_bulk_small.php
2025-08-07 13:15:31 +01:00

69 lines
2.8 KiB
PHP

<?php
ob_Start();
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF('L', 'mm', 'C7', true, 'UTF-8', false);
$pdf->SetMargins(1, 1, 1, true);
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
$pdf->AddPage();
$pdf->SetFont('helvetica', '', 4);
// $var1 = '<table style="border-collapse-bottom:separate; border-spacing:2px;">';
// $var1 = '<table>';
// for($i=0;$i < count($arry); $i+=2){
// $ligne = '<tr>
// <th align="center" width="60" height="52"><img src="'.implode($arry[$i]).'" width="60" height="52"></th>
// <th align="center" width="60" height="52" ><h3>'.key($arry[$i]).'</h3></th>
// <th width="18"></th>';
// if($i<count($arry)-1){$ligne = $ligne.'<th align="center" width="60" height="52" ><img src="'.implode($arry[$i+1]).'" width="60" height="52"></th><th align="center" width="60" height="52"><h3>'.key($arry[$i+1]).'</h3></th>
// ';}
// $ligne = $ligne.'</tr>';
// $content = $var1.$ligne.'</table>';
// $pdf->writeHTML($content, true, false, false, false, '');
// $pdf->AddPage();
// unset($ligne);
// }
//one line print
// $var1 = '<table>';
// for($i=0;$i < count($arry); $i++){
// $ligne = '<tr>
// <th align="center" width="52" height="52"><h3>'.key($arry[$i]).'</h3></th>
// <th align="center" width="52" height="52"><img src="'.implode($arry[$i]).'" width="52" height="52"></th>';
// $ligne = $ligne.'</tr>';
// $content = $var1.$ligne.'</table>';
// $pdf->writeHTML($content, true, false, false, false, '');
// $pdf->AddPage();
// unset($ligne);
// }
$var1 = '<table>';
for($i=0;$i < count($arry); $i++){
$ligne = '<tr><th width="3"></th>
<th align="center" width="52" height="52"><img src="'.implode($arry[$i]).'" width="52" height="52"></th>
<th align="center" width="52" height="52"><h4>'.key($arry[$i]).'</h4></th></th><th width="20"></th>
<th align="center" width="60" height="52"></th><th align="center" width="52" height="52">';
$ligne = $ligne.'</tr>';
$content = $var1.$ligne.'</table>';
$pdf->writeHTML($content, true, false, false, false, '');
$pdf->AddPage();
unset($ligne);
}
if($zone != "all"){
$ligne = '<tr>
<th align="center" width="92" height="40" style="border-right:1px solid black; border-left:1px solid black; border-top:1px solid black; border-bottom:1px solid black;"><h2>'.$zone.'</h2></th></tr>';
$content = $var1.$ligne.'</table>';
$pdf->writeHTML($content, true, false, false, false, '');
}
//$pdf->Image($filename, 10, 10, 15, 15, 'PNG', '', '', true, 150, '', false, false, 1, false, false, false);
//$pdf->SetXY(25, 10);
//$pdf->Cell(50, 15, $libartc, 1, 0, 'L', 0, '', 0, true,'C', 'C');
$pdf->Output('qr_codes.pdf', 'I');