1. Go to this page and download the library: Download phpsoftbox/pdf 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/ */
phpsoftbox / pdf example snippets
use PhpSoftBox\Pdf\Gotenberg\GotenbergHtmlPdfRenderer;
use PhpSoftBox\Pdf\PdfMargins;
use PhpSoftBox\Pdf\PdfPageSize;
use PhpSoftBox\Pdf\PdfRenderOptions;
use PhpSoftBox\Pdf\PdfUnit;
$renderer = new GotenbergHtmlPdfRenderer(
client: $client,
requestFactory: $requestFactory,
streamFactory: $streamFactory,
baseUrl: 'http://gotenberg:3000',
);
$document = $renderer->renderHtml(
html: '<html><body>Этикетка #1</body></html>',
options: new PdfRenderOptions(
pageSize: new PdfPageSize(58, 40, PdfUnit::Mm),
margins: PdfMargins::all(1, PdfUnit::Mm),
printBackground: true,
),
);