I am trying to print tickets for a concert.
At the moment I can print each ticket on a separate sheet of paper. But I would like to be able to print each ticket, with a small gap after each one, on as fewer pages as possible.
Here is the code I have:
for($i = 0; $i < 5; $i++){
$pdf->AddPage();
// background
$pdf->SetAlpha($alpha);
$pdf->Image('../img/banners/'.$row['banner'], 10, 10, 0, 107);
// draw border around image
$pdf->SetAlpha(1);
$pdf->Cell(0,107,'',1,1, 'C');
// logo
$pdf->Image('../img/logo/logo-trans-bg.png', 20, 20, 20, 20);
// name
$pdf->SetFont('Courier','I',12);
$pdf->Text(105 - ($pdf->GetStringWidth($row['name']) / 2), 32, $row['name']);
// price
$pdf->SetFont('Courier','',12);
$price1 = "£".$row['t1_price'];
$pdf->Text(175 - ($pdf->GetStringWidth($price1) / 2), 32, $price1);
// date
$pdf->SetFont('Courier','B',12);
$pdf->Text(155 - ($pdf->GetStringWidth($date) / 2), 105, $date);
// web address
$pdf->SetFont('Courier','BI',12);
$pdf->Text(40 - ($pdf->GetStringWidth('dwhsociety.co.uk') / 2), 105, 'dwhsociety.co.uk');
// concert title
$pdf->SetFont('Courier','B',16);
$pdf->Text(105 - ($pdf->GetStringWidth($row['title']) / 2), 60, $row['title']);
// Adult
if($row['type_1'] != '0'){
$adult = "1 ticket ".$row['t1_label'];
$pdf->SetFont('Courier','',12);
$pdf->Text(105 - ($pdf->GetStringWidth($adult) / 2), 67, $adult);
}
// venue
$pdf->SetFont('Courier','',12);
$pdf->Text(105 - ($pdf->GetStringWidth($row['venue']) / 2), 77, $row['venue']);
}
This of course creates a new page on every loop, which I don’t want.
Any help greatly appreciated.