1. Go to this page and download the library: Download manuxi/sulu-pdf-bundle 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/ */
final class ProductProfile implements PdfProfileInterface
{
public function getName(): string { return 'products'; }
public function getResourceKey(): string { return 'products'; }
public function getDefaultRules(): PdfRules { return new PdfRules(main: '.product-detail'); }
public function getOptions(string $id, string $locale): ?PdfOptions { return new PdfOptions(showAuthor: false); } // null = no PDF
public function getModified(string $id, string $locale): ?\DateTimeInterface { return null; }
}
twig
<a href="{{ sulu_pdf_url('events', event.id, app.request.locale) }}">Download as PDF</a>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.