Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Html2Pdf Bundle Laravel Package

ensepar/html2pdf-bundle

View on GitHub
Deep Wiki
Context7

EnseparHtml2pdfBundle

Build Status

Html2pdf for Symfony as a service.

How to install?

Just add this to your composer.json file:

"require": {
  ...
  "ensepar/html2pdf-bundle" : "^5.0"
}

or via composer:

$ composer require ensepar/html2pdf-bundle

Enable it in bundles if not already

Ensepar\Html2pdfBundle\EnseparHtml2pdfBundle::class => ['all' => true],

How to use?

Via dependency injection:

class Html2Pdf
{
    /**
     * @Route("/create")
     */
    public function create(Html2pdfFactory $html2pdfFactory)
    {

        $html2pdf = $html2pdfFactory->create();
    }
}

Via the container:

$html2pdf = $this->get('html2pdf_factory')->create();

You can pass every option you would pass to html2pdf, for instance :

$html2pdf = $this->get('html2pdf_factory')->create('P', 'A4', 'en', true, 'UTF-8', [10, 15, 10, 15]);

If the previous arguments are not provided, the factory uses its own default values.
You can change those default values by adding the bundle configuration to your config file:

ensepar_html2pdf:
    orientation: 'P'
    format: 'A4'
    lang: 'en'
    unicode: true
    encoding: 'UTF-8'
    margin: [10, 15, 10, 15]

Read more on the library Html2pdf here.

How to run the tests?

$ composer install
$ php vendor/bin/phpunit
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource