require_once 'vendor/autoload.php'; use PDFTable\PDFTable; // Create a new PDF document $pdf = new PDFTable(); // Add a new table with 3 rows and 2 columns $pdf->addTable(3, 2); // Add content to each cell $pdf->setCell(1, 1, 'Cell 1-1'); $pdf->setCell(1, 2, 'Cell 1-2'); $pdf->setCell(2, 1, 'Cell 2-1'); $pdf->setCell(2, 2, 'Cell 2-2'); $pdf->setCell(3, 1, 'Cell 3-1'); $pdf->setCell(3, 2, 'Cell 3-2'); // Output the PDF document $pdf->output();
require_once 'vendor/autoload.php'; use PDFTable\PDFTable; // Create a new PDF document $pdf = new PDFTable(); // Add a new table with 2 rows and 3 columns $pdf->addTable(2, 3); // Set table styles $pdf->setTableStyle([ 'borderColor' => [0, 0, 0], 'fillColor' => [235, 235, 235], 'textColor' => [0, 0, 0], 'font' => 'Helvetica', 'fontSize' => 10, 'rowHeight' => 15, 'columnWidths' => [50, 70, 50], ]); // Set the header row styles $pdf->setHeaderRowStyle([ 'fillColor' => [180, 180, 180], 'textColor' => [0, 0, 0], ]); // Add content to each cell $pdf->setCell(1, 1, 'Name'); $pdf->setCell(1, 2, 'Email'); $pdf->setCell(1, 3, 'Phone'); $pdf->setCell(2, 1, 'John Smith'); $pdf->setCell(2, 2, 'john@example.com'); $pdf->setCell(2, 3, '555-1234'); // Output the PDF document $pdf->output();In both examples, the PDFTable package library was used to create and customize tables in the PDF document.