1. Go to this page and download the library: Download nadar/pdf-generator 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/ */
nadar / pdf-generator example snippets
namespace App\Pdf;
use Nadar\PdfGenerator\AbstractPdfSettings;
use Nadar\PdfGenerator\Font\FontSet;
use Nadar\PdfGenerator\Overflow;
use Nadar\PdfGenerator\Value\Color;
final class BrandPdfSettings extends AbstractPdfSettings
{
public function fontPath(): string { return __DIR__ . '/fonts'; }
public function fontCachePath(): string { return __DIR__ . '/fonts/cache'; }
public function templatePath(): string { return __DIR__ . '/templates'; }
public function fonts(): FontSet
{
return FontSet::make()
->family('inter', 'Inter-Regular.ttf', 'Inter-Bold.ttf')
->role('regular', 'inter')
->role('bold', 'inter', 'bold');
}
public function textColor(): Color { return Color::hex('#223764'); }
// the safe choice for anything data-driven: never throws on a long value
public function overflow(): Overflow { return Overflow::ShrinkThenClip; }
}