Exemple #1
0
        foreach ($data as $row) {
            $this->Cell($w[0], 6, $row[0], 'LR', 0, 'C', $fill);
            $this->Cell($w[1], 6, iconv('UTF-8', 'ISO-8859-1', $row[1]), 'LR', 0, 'C', $fill);
            $this->Cell($w[2], 6, iconv('UTF-8', 'ISO-8859-1', $row[2]), 'LR', 0, 'C', $fill);
            $this->Cell($w[3], 6, $row[3], 'LR', 0, 'C', $fill);
            $this->Cell($w[4], 6, iconv('UTF-8', 'ISO-8859-1', $row[4]), 'LR', 0, 'C', $fill);
            $this->Ln();
            $fill = !$fill;
        }
        //Closure line
        $this->Cell(array_sum($w), 0, '', 'T');
    }
}
$header = array('id', 'Nome', 'Email', 'Contacto', iconv('UTF-8', 'ISO-8859-1', 'Comentário'));
$gl = new Guestlist();
$guests = $gl->ListGuests(' 1 ORDER BY NAME ASC');
$data = array();
$i = 0;
foreach ($guests as $guest) {
    $data[$i][0] = $guest['id'];
    $data[$i][1] = $guest['name'];
    $data[$i][2] = $guest['email'];
    $data[$i][3] = $guest['phone'];
    $data[$i][4] = $guest['comment'];
    $i++;
}
$pdf = new PDF();
$pdf->SetFont('Arial', '', 8);
$pdf->AddPage();
$pdf->ImprovedTable($header, $data);
$pdf->Output();