PHP code example of datadebasa / array2print
1. Go to this page and download the library: Download datadebasa/array2print library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
datadebasa / array2print example snippets
ataDebasa\Array2Print\Array2Print;
// Sample data
$data = [
['id' => 1, 'name' => 'John Doe', 'email' => '[email protected]'],
['id' => 2, 'name' => 'Jane Smith', 'email' => '[email protected]'],
];
// Headers for the table
$headers = [
'id' => 'ID',
'name' => 'Name',
'email' => 'Email'
];
// Create PDF
$pdf = new Array2Print();
$pdf->setData($data)
->setHeaders($headers)
->setSignature('John Manager', 'Manager')
->generate()
->output('report.pdf');