1. Go to this page and download the library: Download peptolab/php2pdf 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/ */
peptolab / php2pdf example snippets
use Php2Pdf\Color\Rgb;
use Php2Pdf\Document\Document;
use Php2Pdf\Document\PageSize;
use Php2Pdf\Geometry\Box;
$doc = new Document('out.pdf');
$doc->info()->setTitle('Hello');
$page = $doc->addPage(PageSize::A4);
$page->setTrimBox(Box::fromMm(10, 10, 190, 277));
$page->canvas()
->setFillColor(Rgb::fromHex('#0088b8'))
->roundedRect(72, 72, 200, 100, 12)
->fill();
$doc->close();