row-bloom/mpdf-renderer

row-bloom mPDF renderer driver

v0.2.0 2024-01-01 15:54 UTC

This package is auto-updated.

Last update: 2024-10-30 17:48:53 UTC


README

Latest Version on Packagist Pest action Pint action Total Downloads

Important

This is a sub-split, for development, pull requests and issues, visit: https://github.com/row-bloom/row-bloom

Installation

composer require row-bloom/mpdf-renderer
use RowBloom\RowBloom\Support;
use RowBloom\MpdfRenderer\MpdfRenderer;

app()->get(Support::class);
    ->registerInterpolatorDriver(MpdfRenderer::NAME, MpdfRenderer::class)

Requires:

  • PHP >= 8.1
  • ext-gd
  • ext-mbstring
  • ext-zlib

Usage

use RowBloom\RowBloom\Interpolators\PhpInterpolator;
use RowBloom\MpdfRenderer\MpdfRenderer;
use RowBloom\RowBloom\RowBloom;
use RowBloom\RowBloom\Types\Table;

app()->get(RowBloom::class)
    ->addTable(Table::fromArray([
        ['title' => 'Title3', 'body' => 'body3'],
        ['title' => 'Title4', 'body' => 'body4'],
    ]))
    ->setInterpolator(PhpInterpolator::class)
    ->setTemplate('
        <h1><?= $title ?></h1>
        <p>Bold text</p>
        <div><?= $body ?></div>
    ')
    ->setRenderer(MpdfRenderer::class)
    ->save(__DIR__.'/foo.pdf');

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.