Giter Club home page Giter Club logo

nucleosdompdfbundle's Introduction

NucleosDompdfBundle

Latest Stable Version Latest Unstable Version License

Total Downloads Monthly Downloads Daily Downloads

Continuous Integration Code Coverage Type Coverage

This bundle provides a wrapper for using dompdf inside Symfony.

Installation

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

composer require nucleos/dompdf-bundle

Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    Nucleos\DompdfBundle\NucleosDompdfBundle::class => ['all' => true],
];

Configure the Bundle

# config/packages/nucleos_dompdf.yaml

nucleos_dompdf:
    defaults:
        defaultFont: 'helvetica'
        # See https://github.com/dompdf/dompdf/wiki/Usage#options for available options

Usage

Whenever you need to turn a html page into a PDF use dependency injection for your service:

use Nucleos\DompdfBundle\Factory\DompdfFactoryInterface;
use Nucleos\DompdfBundle\Wrapper\DompdfWrapperInterface;

final class MyService
{
    public function __construct(DompdfFactoryInterface $factory)
    {
        $this->factory = $factory;
    }

    public function render()
    {
        // ...
        /** @var Dompdf\Dompdf $dompdf */
        $dompdf = $this->factory->create();
        // Or pass an array of options:
        $dompdf = $this->factory->create(['chroot' => '/home']);
        // ...
    }
}

final class MyOtherService
{
    public function __construct(DompdfWrapperInterface $wrapper)
    {
        $this->wrapper = $wrapper;
    }

    public function stream()
    {
        // ...
        $html = '<h1>Sample Title</h1><p>Lorem Ipsum</p>';

        /** @var Symfony\Component\HttpFoundation\StreamedResponse $response */
        $response = $this->wrapper->getStreamResponse($html, "document.pdf");
        $response->send();
        // ...
    }

    public function binaryContent()
    {
        // ...
        return $this->wrapper->getPdf($html);
        // ...
    }
}

Render pdf using Twig

If you use Twig to create the content, make sure to use renderView() instead of render(). Otherwise you might get the following HTTP header printed inside your PDF:

HTTP/1.0 200 OK Cache-Control: no-cache

$html = $this->renderView('my_pdf.html.twig', array(
    // ...
));
$this->wrapper->getStreamResponse($html, 'document.pdf');

Using asset() to link assets

First, make sure your chroot is correctly set and isRemoteEnabled is true.

# config/packages/nucleos_dompdf.yaml

nucleos_dompdf:
    defaults:
        chroot: '%kernel.project_dir%/public/assets'
        isRemoteEnabled: true

Second, use {{ absolute_url( asset() ) }}

<img src={{ absolute_url( asset('assets/example.jpg') ) }}>

Events

The dompdf wrapper dispatches events to conveniently get the inner dompdf instance when creating the PDF.

  • dompdf.output is dispatched in getPdf()
  • dompdf.stream is dispatched in streamHtml()

See Symfony Events and Event Listeners for more info.

License

This bundle is under the MIT license.

nucleosdompdfbundle's People

Contributors

84m avatar core23 avatar dependabot[bot] avatar fd6130 avatar github-actions[bot] avatar julienlegrand07 avatar kevin-lot avatar kl3sk avatar kodiakhq[bot] avatar nucleos-bot avatar renovate-bot avatar renovate[bot] avatar reyostallenberg avatar tgeber avatar thomaslandauer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nucleosdompdfbundle's Issues

Pdf output to the browser doesn't work

In the class Core23\DompdfBundle\Wrapper\DompdfWrapper exists the method streamHtml, which takes an options array as the third parameter. This options are not proceeded to the underlaying stream-method of the dompdf class. So in the stream-method of the used adapter-class, the options passed by the creation of dompdf instance, will allways been overwritten with the default values set in this method. Therfore it's impossible to stream the pdf to the browser.

Bundle does not configure temp and cache paths

I expected the bundle to set the temp and cache paths of DomPDF to Symfony's paths. However, it does not.

This would be very useful as that means that I don't have to reconfigure DomPDF.

The render of images do not work

With the default option, render of images do not work.

Symfony 6.4
Dev run on Windows

config:

nucleos_dompdf:
    defaults:
        chroot: '%kernel.project_dir%/public/assets'
        isRemoteEnabled: true

controller:

#[Route('/testpdf', name: 'pages.test.pdf', methods: ['GET'])]
    public function testPDF(
        DompdfWrapperInterface $wrapper
    ): Response {
        return $wrapper->getStreamResponse(
            $this->renderView('PDF/example.html.twig'),
            'example.pdf',
            [
                'Attachment' => false,
            ]
        );
    }

assets:
image

Twig:

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		{% block stylesheets %}
			{% for file in encore_entry_css_files('app') %}
				<style>
					{{file_get_contents(file)}}</style>
			{% endfor %}
		{% endblock %}
	</head>
	<body>
		<img src={{ absolute_url( asset('assets/logo_ministere.png') ) }}>

	</body>
</html>

PDF :
image

How to resolve this ?

Thanks

Image not found or type unknown

I'm trying to render my template into a PDF file, but images are not rendered, it always appears the msg "Image not found or type unknown". I've already tried with relative and absolute image paths. It's a jpg image.

Can you help me with it?

composer require fails using latest version 2.3.0

Environment

Packages

$ composer show --latest
Restricting packages listed in "symfony/symfony" to "4.1.*"
cocur/slugify                            v3.1    v3.1     Converts a string into a slug.
core23/dompdf-bundle                     2.2.0   2.3.0    This bundle provides a wrapper for using dompdf inside symfony.
doctrine/annotations                     v1.6.0  v1.6.0   Docblock Annotations Parser
doctrine/cache                           v1.8.0  v1.8.0   Caching library offering an object-oriented API for many cache backends
doctrine/collections                     v1.5.0  v1.5.0   Collections Abstraction library
doctrine/common                          v2.9.0  v2.9.0   Common Library for Doctrine projects
doctrine/dbal                            v2.8.0  v2.8.0   Database Abstraction Layer
doctrine/doctrine-bundle                 1.9.1   1.9.1    Symfony DoctrineBundle
doctrine/doctrine-cache-bundle           1.3.3   1.3.3    Symfony Bundle for Doctrine Cache
doctrine/doctrine-migrations-bundle      v1.3.1  v1.3.1   Symfony DoctrineMigrationsBundle
doctrine/event-manager                   v1.0.0  v1.0.0   Doctrine Event Manager component
doctrine/inflector                       v1.3.0  v1.3.0   Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                    1.1.0   1.1.0    A small, lightweight utility to instantiate objects in PHP without invoking their const...
doctrine/lexer                           v1.0.1  v1.0.1   Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                      v1.8.1  v1.8.1   Database Schema migrations using Doctrine DBAL
doctrine/orm                             v2.6.2  v2.6.2   Object-Relational-Mapper for PHP
doctrine/persistence                     v1.0.1  v1.0.1   Doctrine Persistence abstractions.
doctrine/reflection                      v1.0.0  v1.0.0   Doctrine Reflection component
dompdf/dompdf                            v0.8.2  v0.8.2   DOMPDF is a CSS 2.1 compliant HTML to PDF converter
egulias/email-validator                  2.1.6   2.1.6    A library for validating emails against several RFCs
friendsofsymfony/user-bundle             v2.1.2  v2.1.2   Symfony FOSUserBundle
jdorn/sql-formatter                      v1.2.17 v1.2.17  a PHP SQL highlighting library
knplabs/knp-components                   v1.3.10 v1.3.10  Knplabs component library
knplabs/knp-menu                         2.3.0   2.3.0    An object oriented menu library
knplabs/knp-menu-bundle                  v2.2.1  v2.2.1   This bundle provides an integration of the KnpMenu library
knplabs/knp-paginator-bundle             v2.8.0  v2.8.0   Paginator bundle for Symfony to automate pagination and simplify sorting and other feat...
monolog/monolog                          1.23.0  1.23.0   Sends your logs to files, sockets, inboxes, databases and various web services
nikic/php-parser                         v4.0.4  v4.0.4   A PHP parser written in PHP
ocramius/package-versions                1.3.0   1.3.0    Composer plugin that provides efficient querying for installed package versions (no run...
ocramius/proxy-manager                   2.2.2   2.2.2    A library providing utilities to generate, instantiate and generally operate with Objec...
paragonie/random_compat                  v2.0.17 v9.99.99 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phenx/php-font-lib                       0.5.1   0.5.1    A library to read, parse, export and make subsets of different types of font files.
phenx/php-svg-lib                        v0.3.2  v0.3.2   A library to read, parse and export to PDF SVG files.
psr/cache                                1.0.1   1.0.1    Common interface for caching libraries
psr/container                            1.0.0   1.0.0    Common Container Interface (PHP FIG PSR-11)
psr/log                                  1.0.2   1.0.2    Common interface for logging libraries
psr/simple-cache                         1.0.1   1.0.1    Common interfaces for simple caching
sabberworm/php-css-parser                8.1.0   8.2.0    Parser for CSS Files written in PHP
sonata-project/admin-bundle              3.40.1  3.40.1   The missing Symfony Admin Generator
sonata-project/block-bundle              3.12.1  3.12.1   Symfony SonataBlockBundle
sonata-project/cache                     2.0.1   2.0.1    Cache library
sonata-project/core-bundle               3.11.2  3.11.2   Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.3.1   2.3.1    Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.1.0   1.1.0    Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.6.2   3.6.2    Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0   2.5.0    Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.9.1   1.9.1    Lightweight Exporter library
sonata-project/user-bundle               4.2.3   4.2.3    Symfony SonataUserBundle
swiftmailer/swiftmailer                  v6.1.3  v6.1.3   Swiftmailer, free feature-rich PHP mailer
symfony/apache-pack                      v1.0.1  v1.0.1   A pack for Apache support in Symfony
symfony/asset                            v4.1.6  v4.1.6   Symfony Asset Component
symfony/cache                            v4.1.6  v4.1.6   Symfony Cache component with PSR-6, PSR-16, and tags
symfony/config                           v4.1.6  v4.1.6   Symfony Config Component
symfony/console                          v4.1.6  v4.1.6   Symfony Console Component
symfony/debug                            v4.1.6  v4.1.6   Symfony Debug Component
symfony/dependency-injection             v4.1.6  v4.1.6   Symfony DependencyInjection Component
symfony/doctrine-bridge                  v4.1.6  v4.1.6   Symfony Doctrine Bridge
symfony/dotenv                           v4.1.6  v4.1.6   Registers environment variables from a .env file
symfony/event-dispatcher                 v4.1.6  v4.1.6   Symfony EventDispatcher Component
symfony/expression-language              v4.1.6  v4.1.6   Symfony ExpressionLanguage Component
symfony/filesystem                       v4.1.6  v4.1.6   Symfony Filesystem Component
symfony/finder                           v4.1.6  v4.1.6   Symfony Finder Component
symfony/flex                             v1.1.1  v1.1.1   Composer plugin for Symfony
symfony/form                             v4.1.6  v4.1.6   Symfony Form Component
symfony/framework-bundle                 v4.1.6  v4.1.6   Symfony FrameworkBundle
symfony/http-foundation                  v4.1.6  v4.1.6   Symfony HttpFoundation Component
symfony/http-kernel                      v4.1.6  v4.1.6   Symfony HttpKernel Component
symfony/inflector                        v4.1.6  v4.1.6   Symfony Inflector Component
symfony/intl                             v4.1.6  v4.1.6   A PHP replacement layer for the C intl extension that includes additional data from the...
symfony/maker-bundle                     v1.7.0  v1.7.0   Symfony Maker helps you create empty commands, controllers, form classes, tests and mor...
symfony/monolog-bridge                   v4.1.6  v4.1.6   Symfony Monolog Bridge
symfony/monolog-bundle                   v3.3.0  v3.3.0   Symfony MonologBundle
symfony/options-resolver                 v4.1.6  v4.1.6   Symfony OptionsResolver Component
symfony/orm-pack                         v1.0.5  v1.0.5   A pack for the Doctrine ORM
symfony/polyfill-intl-icu                v1.9.0  v1.9.0   Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring                v1.9.0  v1.9.0   Symfony polyfill for the Mbstring extension
symfony/polyfill-php72                   v1.9.0  v1.9.0   Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/profiler-pack                    v1.0.3  v1.0.3   A pack for the Symfony web profiler
symfony/property-access                  v4.1.6  v4.1.6   Symfony PropertyAccess Component
symfony/routing                          v4.1.6  v4.1.6   Symfony Routing Component
symfony/security                         v4.1.6  v4.1.6   Symfony Security Component
symfony/security-acl                     v3.0.1  v3.0.1   Symfony Security Component - ACL (Access Control List)
symfony/security-bundle                  v4.1.6  v4.1.6   Symfony SecurityBundle
symfony/stopwatch                        v4.1.6  v4.1.6   Symfony Stopwatch Component
symfony/swiftmailer-bundle               v3.2.3  v3.2.3   Symfony SwiftmailerBundle
symfony/templating                       v4.1.6  v4.1.6   Symfony Templating Component
symfony/translation                      v4.1.6  v4.1.6   Symfony Translation Component
symfony/twig-bridge                      v4.1.6  v4.1.6   Symfony Twig Bridge
symfony/twig-bundle                      v4.1.6  v4.1.6   Symfony TwigBundle
symfony/validator                        v4.1.6  v4.1.6   Symfony Validator Component
symfony/var-dumper                       v4.1.6  v4.1.6   Symfony mechanism for exploring and dumping PHP variables
symfony/web-profiler-bundle              v4.1.6  v4.1.6   Symfony WebProfilerBundle
symfony/yaml                             v4.1.6  v4.1.6   Symfony Yaml Component
twig/extensions                          v1.5.2  v1.5.2   Common additional features for Twig that do not directly belong in core
twig/twig                                v2.5.0  v2.5.0   Twig, the flexible, fast, and secure template language for PHP
zendframework/zend-code                  3.3.1   3.3.1    provides facilities to generate arbitrary code using an object oriented interface
zendframework/zend-eventmanager          3.2.1   3.2.1    Trigger and listen to events within a PHP application

PHP version

$ php -v
PHP 7.2.8 (cli) (built: Jul 18 2018 10:18:27) ( ZTS MSVC15 (Visual C++ 2017) x86 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.8, Copyright (c) 1999-2018, by Zend Technologies

Subject

After composer require, when the script cache:clear is executed, composer throws an error Circular reference detected for service "dompdf", path: "dompdf -> Core23\DompdfBundle\Wrapper\DompdfWrapper -> dompdf"

Steps to reproduce

call composer require core23/dompdf-bundle

Suggestions to improve README.md

Feature Request

  • What can $options be in streamHtml() and getPdf()? Example?
  • "Enable the Bundle" is not necessary if you use Symfony 4 or Flex - I'm not sure which it is :-)
  • Which other defaults can be configured in core23_dompdf.yaml?
  • How can you add meta data (without the bundle it's: $dompdf->add_info('Title', $title);)

I can't create additional PR's, since I don't know the answers ;-)

Landscape mode

Is this a DomPDF bug of this plugin ? No land scape is possible.

Alternative question, is this bundle maintained ?

Thanks.

Environment

WSL

Packages

$ composer show --latest
azuyalabs/yasumi                    2.6.0              2.6.0              The easy PHP Library for calculating holidays.
beberlei/doctrineextensions         v1.3.0             v1.3.0             A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.
codex-team/editor.js                dev-master 9446738 dev-master 9446738 PHP backend implementation for the Editor.js
deployer/deployer                   v7.3.3             v7.3.3             Deployment Tool
doctrine/annotations                2.0.1              2.0.1              Docblock Annotations Parser
doctrine/doctrine-bundle            2.11.1             2.11.1             Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle   3.5.1              3.5.1              Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle 3.3.0              3.3.0              Symfony DoctrineMigrationsBundle
doctrine/orm                        2.17.1             2.17.1             Object-Relational-Mapper for PHP
dukecity/command-scheduler-bundle   v5.0.7             v5.0.7             This Symfony bundle will allow you to schedule all your commands just like UNIX crontab
fresh/doctrine-enum-bundle          v9.2.0             v10.0.0            Provides support of ENUM type for Doctrine2 in Symfony applications.
friendsofsymfony/jsrouting-bundle   3.4.0              3.4.1              A pretty nice way to expose your Symfony routing to client applications.
hidehalo/nanoid-php                 1.1.13             1.1.13             A copy of nanoid in PHP
knplabs/knp-menu-bundle             v3.3.0             v3.3.0             This bundle provides an integration of the KnpMenu library
knplabs/knp-paginator-bundle        v6.3.0             v6.3.0             Paginator bundle for Symfony to automate pagination and simplify sorting and other features
knplabs/knp-time-bundle             v2.2.0             v2.2.0             Making your dates and durations look sensible and descriptive
lcobucci/jwt                        5.2.0              5.2.0              A simple library to work with JSON Web Token and JSON Web Signature
league/commonmark                   2.4.1              0.5.1              Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)
liip/functional-test-bundle         4.10.0             4.10.0             This bundles provides additional functional test-cases for Symfony applications
liip/imagine-bundle                 2.12.1             2.6.1              This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.
liip/test-fixtures-bundle           2.7.0              2.7.0              This bundles enables efficient loading of Doctrine fixtures in functional test-cases for Symfony applications
mossadal/math-parser                v1.3.16            v1.3.16            PHP parser for mathematical expressions, including elementary functions, variables and implicit multiplication. Also supports symbo...
nucleos/dompdf-bundle               4.0.0              4.0.0              This bundle provides a wrapper for using dompdf inside symfony.
phpoffice/phpspreadsheet            1.29.0             [none matched]     PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
phpunit/phpunit                     9.6.15             5.2.7              The PHP Unit Testing framework.
stof/doctrine-extensions-bundle     v1.10.1            v1.10.1            Integration of the gedmo/doctrine-extensions with Symfony
symfony/asset                       v6.4.0             v7.0.0             Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
symfony/browser-kit                 v6.4.0             v7.0.0             Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically
symfony/console                     v6.4.1             v7.0.1             Eases the creation of beautiful and testable command line interfaces
symfony/css-selector                v6.4.0             v7.0.0             Converts CSS selectors to XPath expressions
symfony/debug-bundle                v6.4.0             v7.0.0             Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-s...
symfony/doctrine-messenger          v6.4.1             v7.0.1             Symfony Doctrine Messenger Bridge
symfony/dotenv                      v6.4.0             v7.0.0             Registers environment variables from a .env file
symfony/flex                        v2.4.2             v2.4.2             Composer plugin for Symfony
symfony/form                        v6.4.1             v7.0.1             Allows to easily create, process and reuse HTML forms
symfony/framework-bundle            v6.4.1             v7.0.1             Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/html-sanitizer              v6.4.0             v7.0.0             Provides an object-oriented API to sanitize untrusted HTML input for safe insertion into a document's DOM.
symfony/http-client                 v6.4.0             v7.0.0             Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/intl                        v6.4.0             v7.0.0             Provides access to the localization data of the ICU library
symfony/mailer                      v6.4.0             v7.0.0             Helps sending emails
symfony/maker-bundle                v1.52.0            v1.52.0            Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplat...
symfony/mercure-bundle              v0.3.8             v0.3.8             Symfony MercureBundle
symfony/messenger                   v6.4.0             v7.0.1             Helps applications send and receive messages to/from other applications or via message queues
symfony/monolog-bundle              v3.10.0            v3.10.0            Symfony MonologBundle
symfony/notifier                    v6.4.0             v7.0.0             Sends notifications via one or more channels (email, SMS, ...)
symfony/password-hasher             v6.2.0             v7.0.0             Provides password hashing utilities
symfony/phpunit-bridge              v6.4.1             v7.0.1             Provides utilities for PHPUnit, especially user deprecation notices management
symfony/proxy-manager-bridge        v6.4.0             v6.4.0             Provides integration for ProxyManager with various Symfony components
symfony/requirements-checker        v2.0.1             v2.0.1             Check Symfony requirements and give recommendations
symfony/runtime                     v6.4.0             v7.0.0             Enables decoupling PHP applications from global state
symfony/security-bundle             v6.4.0             v7.0.0             Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/sendinblue-mailer           v6.4.0             v6.4.0             Symfony Sendinblue Mailer Bridge
symfony/stopwatch                   v6.4.0             v7.0.0             Provides a way to profile code
symfony/templating                  v6.4.0             v6.4.0             Provides all the tools needed to build any kind of template system
symfony/translation                 v6.4.0             v7.0.0             Provides tools to internationalize your application
symfony/twig-bundle                 v6.4.0             v7.0.0             Provides a tight integration of Twig into the Symfony full-stack framework
symfony/uid                         v6.4.0             v7.0.0             Provides an object-oriented API to generate and represent UIDs
symfony/ux-autocomplete             v2.13.3            v2.13.3            JavaScript Autocomplete functionality for Symfony
symfony/ux-chartjs                  v2.13.2            v2.13.2            Chart.js integration for Symfony
symfony/ux-live-component           v2.13.3            v2.13.3            Live components for Symfony
symfony/ux-svelte                   v2.13.2            v2.13.2            Integration of Svelte in Symfony
symfony/ux-toggle-password          v2.13.2            v2.13.2            Toggle visibility of password inputs for Symfony Forms
symfony/ux-twig-component           v2.13.3            v2.13.3            Twig components for Symfony
symfony/ux-typed                    v2.13.2            v2.13.2            Typed integration for Symfony
symfony/validator                   v6.4.0             v7.0.0             Provides tools to validate values
symfony/var-dumper                  v6.4.0             v7.0.0             Provides mechanisms for walking through any arbitrary PHP variable
symfony/web-link                    v6.4.0             v7.0.0             Manages links between resources
symfony/web-profiler-bundle         v6.4.0             v7.0.0             Provides a development tool that gives detailed information about the execution of any request
symfony/webpack-encore-bundle       v2.1.1             v2.1.1             Integration with your Symfony app & Webpack Encore!
symfony/workflow                    v6.4.1             v7.0.1             Provides tools for managing a workflow or finite state machine
symfony/yaml                        v6.4.0             v7.0.0             Loads and dumps YAML files
symfonycasts/dynamic-forms          v0.1.1             v0.1.1             Add dynamic/dependent fields to Symfony forms
symfonycasts/reset-password-bundle  v1.19.0            v1.20.0            Symfony bundle that adds password reset functionality.
symfonycasts/verify-email-bundle    v1.15.0            v1.16.0            Simple, stylish Email Verification for Symfony
tattali/mobile-detect-bundle        v2.2.7             v2.2.7             Symfony 3.4-6.x bundle to detect mobile devices, manage mobile view and redirect to the mobile and tablet version.
twig/cssinliner-extra               v3.8.0             v3.8.0             A Twig extension to allow inlining CSS
twig/extra-bundle                   v3.8.0             v3.8.0             A Symfony bundle for extra Twig extensions
twig/inky-extra                     v3.8.0             v3.8.0             A Twig extension for the inky email templating engine
twig/intl-extra                     v3.8.0             v3.8.0             A Twig extension for Intl
twig/markdown-extra                 v3.8.0             v3.8.0             A Twig extension for Markdown
twig/twig                           v3.8.0             v3.8.0             Twig, the flexible, fast, and secure template language for PHP
vich/uploader-bundle                2.2.0              2.3.0              Ease file uploads attached to entities

Transitive dependencies not required in composer.json:
behat/transliterator                v1.5.0             v1.5.0             String transliterator
carbonphp/carbon-doctrine-types     2.1.0              3.1.0              Types to use Carbon in Doctrine
dflydev/dot-access-data             v3.0.2             v3.0.2             Given a deep data structure, access data by dot notation.
doctrine/cache                      2.2.0              2.2.0              PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mon...
doctrine/collections                2.1.4              2.1.4              PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                     3.4.3              3.4.3              PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as bett...
doctrine/data-fixtures              1.7.0              1.7.0              Data Fixtures for all Doctrine Object Managers
doctrine/dbal                       3.7.2              3.7.2              Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations               1.1.2              1.1.2              A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively f...
doctrine/event-manager              2.0.0              2.0.0              The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                  2.0.8              2.0.8              PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural ...
doctrine/instantiator               2.0.0              2.0.0              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                      2.1.0              3.0.0              PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                 3.7.2              3.7.2              PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your ...
doctrine/persistence                3.2.0              3.2.0              The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.
doctrine/sql-formatter              1.1.3              1.1.3              a PHP SQL highlighting library
dompdf/dompdf                       v2.0.3             v0.6.2             DOMPDF is a CSS 2.1 compliant HTML to PDF converter
dragonmantank/cron-expression       v3.3.3             v3.3.3             CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
egulias/email-validator             4.0.2              4.0.2              A library for validating emails against several RFCs
ezyang/htmlpurifier                 v4.17.0            v4.17.0            Standards compliant HTML filter written in PHP
friendsofphp/proxy-manager-lts      v1.0.16            v1.0.16            Adding support for a wider range of PHP versions to ocramius/proxy-manager
gedmo/doctrine-extensions           v3.14.0            v3.14.0            Doctrine behavioral extensions
imagine/imagine                     1.3.5              1.3.5              Image processing for PHP 5.3
jms/metadata                        2.8.0              2.8.0              Class/method/property metadata management in PHP
knplabs/knp-components              v4.3.0             v4.3.0             Knplabs component library
knplabs/knp-menu                    v3.4.0             v3.4.0             An object oriented menu library
laminas/laminas-code                4.13.0             4.13.0             Extensions to the PHP Reflection API, static code scanning, and code generation
league/config                       v1.2.0             v1.2.0             Define configuration arrays with strict schemas and access values with dot notation
league/uri                          7.4.0              7.4.0              URI manipulation library
league/uri-interfaces               7.4.0              7.4.0              Common interfaces and classes for URI representation and interaction
lorenzo/pinky                       1.1.0              1.1.0              A Foundation for Emails (Inky) template transpiler
lorisleiva/cron-translator          v0.4.4             v0.4.4             Makes CRON expressions human-readable
maennchen/zipstream-php             3.1.0              2.3.0              ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.
markbaker/complex                   3.0.2              3.0.2              PHP Class for working with complex numbers
markbaker/matrix                    3.0.1              3.0.1              PHP Class for working with matrices
masterminds/html5                   2.8.1              2.8.1              An HTML5 parser and serializer.
mobiledetect/mobiledetectlib        2.8.45             4.8.04             Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP he...
monolog/monolog                     3.5.0              3.5.0              Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy                   1.11.1             1.11.1             Create deep copies (clones) of your objects
nesbot/carbon                       2.72.1             2.72.1             An API extension for DateTime that supports 281 different languages.
nette/schema                        v1.2.5             v1.2.5             ๐Ÿ“ Nette Schema: validating data structures against a given Schema.
nette/utils                         v4.0.3             v4.0.3             ๐Ÿ›   Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, ...
nikic/php-parser                    v4.18.0            v4.18.0            A PHP parser written in PHP
paragonie/random_compat             v9.99.100          v9.99.100          PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest                    2.0.3              2.0.3              Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                     3.2.1              3.2.1              Library for handling version information and constraints
phenx/php-font-lib                  0.5.4              0.5.2              A library to read, parse, export and make subsets of different types of font files.
phenx/php-svg-lib                   0.5.1              0.3.4              A library to read, parse and export to PDF SVG files.
phpunit/php-code-coverage           9.2.29             10.1.10            Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator           3.0.6              4.1.0              FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                 3.1.1              4.0.0              Invoke callables with a timeout
phpunit/php-text-template           2.0.4              3.0.1              Simple template engine.
phpunit/php-timer                   5.0.3              6.0.0              Utility class for timing
psr/cache                           3.0.0              3.0.0              Common interface for caching libraries
psr/clock                           1.0.0              1.0.0              Common interface for reading the clock.
psr/container                       2.0.2              2.0.2              Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                1.0.0              1.0.0              Standard interfaces for event handling.
psr/http-client                     1.0.3              1.0.3              Common interface for HTTP clients
psr/http-factory                    1.0.2              1.0.2              Common interfaces for PSR-7 HTTP message factories
psr/http-message                    2.0                2.0                Common interface for HTTP messages
psr/link                            2.0.1              2.0.1              Common interfaces for HTTP links
psr/log                             3.0.0              3.0.0              Common interface for logging libraries
psr/simple-cache                    3.0.0              3.0.0              Common interfaces for simple caching
sabberworm/php-css-parser           8.4.0              8.4.0              Parser for CSS Files written in PHP
sebastian/cli-parser                1.0.1              2.0.0              Library for parsing CLI options
sebastian/code-unit                 1.0.8              2.0.0              Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup  2.0.3              3.0.0              Looks up which function or method a line of code belongs to
sebastian/comparator                4.0.8              4.0.8              Provides the functionality to compare PHP values for equality
sebastian/complexity                2.0.2              3.1.0              Library for calculating the complexity of PHP code units
sebastian/diff                      4.0.5              5.0.3              Diff implementation
sebastian/environment               5.1.5              6.0.1              Provides functionality to handle HHVM/PHP environments
sebastian/exporter                  4.0.5              4.0.5              Provides the functionality to export PHP variables for visualization
sebastian/global-state              5.0.6              6.0.1              Snapshotting of global state
sebastian/lines-of-code             1.0.3              2.0.1              Library for counting the lines of code in PHP source code
sebastian/object-enumerator         4.0.4              5.0.0              Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector          2.0.4              3.0.0              Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context         4.0.5              5.0.0              Provides functionality to recursively process PHP variables
sebastian/resource-operations       3.0.3              3.0.3              Provides a list of PHP built-in functions that operate on resources
sebastian/type                      3.2.1              4.0.0              Collection of value objects that represent the types of the PHP type system
sebastian/version                   3.0.2              4.0.1              Library that helps with managing the version number of Git-hosted PHP projects
symfony/cache                       v6.4.0             v7.0.0             Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts             v3.4.0             v3.4.0             Generic abstractions related to caching
symfony/clock                       v6.4.0             v7.0.0             Decouples applications from the system clock
symfony/config                      v6.4.0             v7.0.0             Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/dependency-injection        v6.4.1             v7.0.1             Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts       v3.4.0             v3.4.0             A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge             v6.4.0             v7.0.0             Provides integration for Doctrine with various Symfony components
symfony/dom-crawler                 v6.4.0             v7.0.0             Eases DOM navigation for HTML and XML documents
symfony/error-handler               v6.4.0             v7.0.0             Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher            v6.4.0             v7.0.0             Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts  v3.4.0             v3.4.0             Generic abstractions related to dispatching event
symfony/expression-language         v6.4.0             v7.0.0             Provides an engine that can compile and evaluate expressions
symfony/filesystem                  v6.4.0             v7.0.0             Provides basic utilities for the filesystem
symfony/finder                      v6.4.0             v7.0.0             Finds files and directories via an intuitive fluent interface
symfony/http-client-contracts       v3.4.0             v3.4.0             Generic abstractions related to HTTP clients
symfony/http-foundation             v6.4.0             v7.0.0             Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                 v6.4.1             v7.0.1             Provides a structured process for converting a Request into a Response
symfony/lock                        v6.4.0             v7.0.0             Creates and manages locks, a mechanism to provide exclusive access to a shared resource
symfony/mercure                     v0.6.4             v0.6.4             Symfony Mercure Component
symfony/mime                        v6.4.0             v7.0.0             Allows manipulating MIME messages
symfony/monolog-bridge              v6.4.0             v7.0.0             Provides integration for Monolog with various Symfony components
symfony/options-resolver            v6.4.0             v7.0.0             Provides an improved replacement for the array_replace PHP function
symfony/polyfill-intl-grapheme      v1.28.0            v1.28.0            Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu           v1.28.0            v1.28.0            Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn           v1.28.0            v1.28.0            Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer    v1.28.0            v1.28.0            Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring           v1.28.0            v1.28.0            Symfony polyfill for the Mbstring extension
symfony/polyfill-php83              v1.28.0            v1.28.0            Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions
symfony/polyfill-uuid               v1.28.0            v1.28.0            Symfony polyfill for uuid functions
symfony/process                     v6.4.0             v7.0.0             Executes commands in sub-processes
symfony/property-access             v6.4.0             v7.0.0             Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info               v6.4.0             v7.0.0             Extracts information about PHP class' properties using metadata of popular sources
symfony/routing                     v6.4.1             v7.0.1             Maps an HTTP request to a set of configuration variables
symfony/security-core               v6.4.0             v7.0.1             Symfony Security Component - Core Library
symfony/security-csrf               v6.4.0             v7.0.1             Symfony Security Component - CSRF Library
symfony/security-http               v6.4.0             v7.0.1             Symfony Security Component - HTTP Integration
symfony/serializer                  v6.4.1             v7.0.1             Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and...
symfony/service-contracts           v3.4.0             v3.4.0             Generic abstractions related to writing services
symfony/stimulus-bundle             v2.13.3            v2.13.3            Integration with your Symfony app & Stimulus!
symfony/string                      v6.4.0             v7.0.0             Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation-contracts       v3.4.0             v3.4.0             Generic abstractions related to translation
symfony/twig-bridge                 v6.4.0             v7.0.0             Provides integration for Twig with various Symfony components
symfony/var-exporter                v6.4.1             v7.0.1             Allows exporting any serializable PHP data structure to plain PHP code
theseer/tokenizer                   1.2.2              1.2.2              A small library for converting tokenized PHP source code into XML and potentially other formats
tijsverkoyen/css-to-inline-styles   v2.2.7             v2.2.7             CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very us...
webmozart/assert                    1.11.0             1.11.0             Assertions to validate method input/output with nice error messages.
willdurand/jsonp-callback-validator v2.0.0             v2.0.0             JSONP callback validator.

PHP version

$ php -v
PHP 8.2.12 (cli) (built: Oct 27 2023 13:00:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.12, Copyright (c), by Zend Technologies
    with Xdebug v3.2.1, Copyright (c) 2002-2023, by Derick Rethans

Subject

Steps to reproduce

$response = $this->wrapper->getStreamResponse($html, 'note de frais.pdf', [
    'setPaper'   => ['A4', 'landscape'],
    'compress'   => 1,
    'Attachment' => 0,
]);

Expected results

PDF in landscape

Actual results

No landscape

Can't install on symfony 5.0

Environment

Symfony 5.0.1

Packages

Fresh symfony install with Twig

$ composer show --latest
# Put the result here.
psr/cache                          1.0.1   1.0.1   Common interface for caching libraries
psr/container                      1.0.0   1.0.0   Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher               1.0.0   1.0.0   Standard interfaces for event handling.
psr/log                            1.1.2   1.1.2   Common interface for logging libraries
symfony/cache                      v5.0.1  v5.0.1  Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts            v2.0.1  v2.0.1  Generic abstractions related to caching
symfony/config                     v5.0.1  v5.0.1  Symfony Config Component
symfony/console                    v5.0.1  v5.0.1  Symfony Console Component
symfony/dependency-injection       v5.0.1  v5.0.1  Symfony DependencyInjection Component
symfony/dotenv                     v5.0.1  v5.0.1  Registers environment variables from a .env file
symfony/error-handler              v5.0.1  v5.0.1  Symfony ErrorHandler Component
symfony/event-dispatcher           v5.0.1  v5.0.1  Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v2.0.1  v2.0.1  Generic abstractions related to dispatching event
symfony/filesystem                 v5.0.1  v5.0.1  Symfony Filesystem Component
symfony/finder                     v5.0.1  v5.0.1  Symfony Finder Component
symfony/flex                       v1.5.3  v1.5.3  Composer plugin for Symfony
symfony/framework-bundle           v5.0.1  v5.0.1  Symfony FrameworkBundle
symfony/http-foundation            v5.0.1  v5.0.1  Symfony HttpFoundation Component
symfony/http-kernel                v5.0.1  v5.0.1  Symfony HttpKernel Component
symfony/mime                       v5.0.1  v5.0.1  A library to manipulate MIME messages
symfony/polyfill-intl-idn          v1.13.1 v1.13.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring          v1.13.1 v1.13.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php73             v1.13.1 v1.13.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/routing                    v5.0.1  v5.0.1  Symfony Routing Component
symfony/service-contracts          v2.0.1  v2.0.1  Generic abstractions related to writing services
symfony/translation-contracts      v2.0.1  v2.0.1  Generic abstractions related to translation
symfony/twig-bridge                v5.0.1  v5.0.1  Symfony Twig Bridge
symfony/twig-bundle                v5.0.1  v5.0.1  Symfony TwigBundle
symfony/twig-pack                  v1.0.0  v1.0.0  A Twig pack for Symfony projects
symfony/var-dumper                 v5.0.1  v5.0.1  Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v5.0.1  v5.0.1  A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/yaml                       v5.0.1  v5.0.1  Symfony Yaml Component
twig/extra-bundle                  v3.0.0  v3.0.0  A Symfony bundle for extra Twig extensions
twig/twig                          v3.0.0  v3.0.0  Twig, the flexible, fast, and secure template language for PHP

PHP version

$ php -v
# Put the result here.
PHP 7.3.11 (cli) (built: Oct 22 2019 11:20:18) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

Subject

Executing composer require core23/dompdf-bundle does not install the package but instead gives an error saying that there's no matching package for symfony/config

Steps to reproduce

symfony new foo
cd foo
composer require core23/dompdf-bundle

Expected results

Package installed correctly

Actual results

Using version ^2.5 for core23/dompdf-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.0.*"
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for core23/dompdf-bundle ^2.5 -> satisfiable by core23/dompdf-bundle[2.5.0].
    - core23/dompdf-bundle 2.5.0 requires symfony/config ^3.4 || ^4.0 -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

composer
composer.json
  • php ^8.1
  • dompdf/dompdf ^1.0.0 || ^2.0.0 || ^3.0.0
  • symfony/config ^6.4 || ^7.0
  • symfony/dependency-injection ^6.4 || ^7.0
  • symfony/event-dispatcher-contracts ^1.1 || ^2.0 || ^3.0
  • symfony/expression-language ^6.4 || ^7.0
  • symfony/framework-bundle ^6.4 || ^7.0
  • symfony/http-foundation ^6.4 || ^7.0
  • symfony/http-kernel ^6.4 || ^7.0
  • ergebnis/composer-normalize ^2.0.1
  • symfony/browser-kit ^6.4 || ^7.0
vendor-bin/tools/composer.json
  • friendsofphp/php-cs-fixer ^3.3
  • maglnet/composer-require-checker ^4.0
  • matthiasnoback/symfony-dependency-injection-test ^5.0
  • phpmd/phpmd ^2.10
  • phpstan/extension-installer ^1.0
  • phpstan/phpstan ^1.0
  • phpstan/phpstan-doctrine ^1.0
  • phpstan/phpstan-phpunit ^1.0
  • phpstan/phpstan-strict-rules ^1.0
  • phpstan/phpstan-symfony ^1.0
  • phpunit/phpunit ^10.0
  • psalm/plugin-phpunit ^0.19
  • psalm/plugin-symfony ^5.0
  • symfony/phpunit-bridge ^7.0
  • vimeo/psalm ^5.0
github-actions
.github/workflows/automatic-release.yml
.github/workflows/continuous-integration.yml

  • Check this box to trigger a request for Renovate to run again on this repository

Alias dompdf service to class

Feature Request

Can we create an alias of dompdf service to the DompdfWrapper class.
In that way a developer can take full advanctage of autowiring.

We could als document this usage instead of using $dompdf = $this->get('dompdf');

defaultPaperSize

Hi,
it seems as if the "defaultPaperSize" option is not working. (no effect)
Neither in the options array of streamHtml od getPdf nor in the config file.

Best regards
Marco

Container exception

Hi,

I got Exception when i want to use your bundle in symfony 4.0.4 project.

(1/1) FatalThrowableError
Type error: Return value of ContainerBEs80iu\srcDevDebugProjectContainer::{closure}() must be an instance of dompdf, instance of Core23\DompdfBundle\Wrapper\DompdfWrapper returned

Generated container

}, 'dompdf' => function (): \dompdf {
    return ($this->services['dompdf'] ?? $this->load(__DIR__.'/getDompdfService.php'));

In service

  public static function getSubscribedServices()
    {
        return array_merge(parent::getSubscribedServices(), [
            Breadcrumbs::class,
            'translator' => TranslatorInterface::class,
            Templates::class,
            'dompdf'
        ]);
    }

But when i change getSubscribedServices to 'dompdf' => DompdfWrapper::class or 'dompdf' => DompdfWrapperInterface::class i got

The service "App\Controller\Tools\LogController" has a dependency on a non-existent service "Core23\DompdfBundle\Wrapper\DompdfWrapper".

services.yaml

services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true   
        autoconfigure: true
        public: false     # <------

I try 2.1 and master, PHP 7.2.2. Dompdf v0.8.2

thanks for your work
greetings

Set sensible default value for `chroot`

Feature Request

Since 0.8.6 dompdf requires a chroot setting for loading assets. From the fact that around 10 (!) issues were opened as a result ( see dompdf/dompdf#2229 for an overview), I'm concluding that this is causing people some trouble ;-)

https://github.com/dompdf/dompdf/wiki/Usage#options recommends setting an "absolute path".

So I'm suggesting to include a default value for this, which makes sense for Symfony. Maybe %kernel.project_dir%/public?

function streamHtml is deprecated, use getStreamResponse instead

Question

When i inject DompdfWrapperInterface into my code, my vscode IDE keep telling me undefine method of getStreamResponse(). When i look into the interface, the comment above thestreamHtml() said use getStreamResponse() instead but i don't see the method define in the interface but in DompdfWrapper class instead.

How about adding getStreamResponse() into the interface to remove the IDE warning? Or we can just inject DompdfWrapper instead of an Interface, perhaps the docs need to update as well?

Dispatch event before streaming or outputting

Feature Request

It would be great to have events (for example a Generic Event Object) dispatched before these lines:

With as event subject the $pdf variable. In that way a programmer can for example get the DomPDF canvas to do some modifications at the end that always need to be done.

An example implementation could be:

// require symfony/event-dispatcher
// inject the event dispatcher
// create Core23\DompdfBundle\Events class with suitable constants

// DompdfWrapper::streamHtml
$event = new \Symfony\Component\EventDispatcher\GenericEvent($pdf);
$this->dispatcher->dispatch(\Core23\DompdfBundle\Events::STREAM, $event);
$event->getSubject()->stream($filename);

// DompdfWrapper::getPdf
$event = new \Symfony\Component\EventDispatcher\GenericEvent($pdf);
$this->dispatcher->dispatch(\Core23\DompdfBundle\Events::OUTPUT, $event);
$event->getSubject()->output();

Docker caveat

Question and answer

Hello, I faced the problem with loading image as seen in this issue.
All fixes were made without any success. But after a repairing night, the solution come to me, so I would like to share it with you.

I've read lot of issues here and on DomPDF repo as well.
I saw on the DomPDF options that ext_curl or allow_url_fopen should be enabled, so images where not loaded directly by the web server but by the PHP engine.

And because I'm using docker with to separate container it could nerver work.

This couldn't be fix on the package but a notice can be set.

Using docker-compose on {{ absolute_url(asset( <image path> )) }} I just replace the host (localhost in my case) with the "linked" container name (web in my case).

A simple {{ absolute_url(asset( <image path> ))|replace({'localhost': 'web'}) }} fix my problem.

In fact this solution should be per project, I personally create a Twig extension that replace it only on Dev env.

Phpstan analyse

Hello,

I noticed an error while parsing phpStan when using DompdfWrapperInterface in a service.

As the stremHtml method is marked as deprecated, I feel like it would just be enough to add the getStreamResponse method in the interface

Here is the phpstan message:
Call to an undefined method Nucleos \ DompdfBundle \ Wrapper \ DompdfWrapperInterface :: getStreamResponse ().

I allowed myself to give you a PullRequest.

ServiceNotFoundException / Dependency Injection

Environment

DEV

PHP version

7.2
Symfony 3.4.17, Symfony Flex

Subject

Service not found with $this->get('dompdf'); in a Controller.

Actual results

Service "dompdf" not found: even though it exists in the app's container, the container inside "App\Controller\MyController" is a smaller service locator that only knows about the "doctrine", "form.factory", "http_kernel", "request_stack", "router", "session", "templating" and "twig" services. Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "MyController::getSubscribedServices()".

Css is ignored

Hi,

How do I make dompdf to see my css files?

Here is how I load css files

<head>
    <!-- Web Fonts  -->
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" rel="stylesheet" type="text/css">

    <!-- Vendor CSS -->
    <link rel="stylesheet" href="{{ absolute_url(asset('build/admin/vendor/bootstrap/css/bootstrap.min.css')) }}" />

    <!-- Invoice Print Style -->
    <link rel="stylesheet" href="{{ absolute_url(asset('build/admin/css/invoice-print.css')) }}" />
</head>

And output is just white html page with css.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.