rezozero/pdfsafe

Twig extension to clean-up an HTML content for PDF generation (psliwa/php-pdf)

1.1.2 2020-12-23 11:44 UTC

This package is auto-updated.

Last update: 2024-10-23 20:11:32 UTC


README

Packagist

Clean a HTML/XML input to be generated in PDF by psliwa/php-pdf library.

Install

composer require rezozero/pdfsafe

Add this extension in your Twig environment.

use RZ\PdfSafe\PdfSafeExtension;
use Symfony\Component\HttpFoundation\Request;

$container->extend('twig.extensions', function ($extensions, $c) {
    /** @var Request $request */
    $request = $c['request'];
    $extensions->add(new PdfSafeExtension($request->getSchemeAndHttpHost()));
    return $extensions;
});