Bulk Document Generator
You can install the package via composer:
composer require kduma/bulk-generator
use Kduma\BulkGenerator\ContentGenerators\SimpleTemplateWithPlaceholdersContentGenerator;
use Kduma\BulkGenerator\DataSources\CsvWithHeadersDataSource;
use Kduma\BulkGenerator\PdfGenerators\MpdfGenerator;
use Kduma\BulkGenerator\PageOptions\PageMargins;
use Kduma\BulkGenerator\PageOptions\PageSize;
use Kduma\BulkGenerator\BulkGenerator;
$dataSource = new CsvWithHeadersDataSource('data.csv');
$pdfGenerator = new MpdfGenerator(
PageSize::fromName('A6', true),
PageMargins::makeByAxis(5, 5)
);
$generator = (new BulkGenerator($dataSource, $pdfGenerator))
->setFrontTemplate('front_template.pdf')
->setFrontContentGenerator(new SimpleTemplateWithPlaceholdersContentGenerator('Hello {name}!'));
$generator->generate('output.pdf');
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The GNU GPLv3. Please see License File for more information.