apsg/certificate

Create PDF certificates

0.1.0 2021-04-30 11:12 UTC

README

Latest Version on Packagist Total Downloads Build Status StyleCI

Helper package to provide easy PDF certificates generation. It uses FPDI/FPDF under the hood and is configured to provide support for Polish language. It works as a Laravel 5/6 package but there is not much of Laravel specific functionality added, so it can be used in other projects as well.

Installation

Via Composer

$ composer require apsg/certificate

Usage

use Apsg\Certificate\Certificate;
use Apsg\Certificate\Fields\Field;
use Apsg\Certificate\Formats\A4LandscapeFormat;

class CertificateController extends Controller
{
    /**
     * This will output the pdf to browser to download
     */
    public function test()
    {
        $certificate = new Certificate(null, new A4LandscapeFormat());

        return $certificate
            ->setBackground(storage_path('app/public/tlo.png'))
            ->addField(new Field('test zażółć gęślą', 10, 100, 20))
            ->generate();
    }
}
 

Note: the background would be stretched to fill the page, so use proper resolution and orientation for best results.

Testing

$ composer test