PHP code example of manuxi / sulu-pdf-bundle

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/ */

    

manuxi / sulu-pdf-bundle example snippets


Manuxi\SuluPdfBundle\SuluPdfBundle::class => ['all' => true],

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>