Weave Code
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

carlescliment/html2pdf-bundle

View on GitHub
Deep Wiki
Context7

Html2PdfServiceBundle

Build Status

This is a Symfony 2 client for the Html2Pdf REST Service.

Installation

Include the bundle in your composer.json file.

    "require": {
        ...
        "carlescliment/html2pdf-bundle": "dev-master"
    }

Modify your AppKernel:

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new carlescliment\Html2PdfServiceBundle\carlesclimentHtml2PdfServiceBundle(),
        );

Set the bundle configuration in your config.yml:

parameters:
    html2pdf.host: http://html2pdf.mydomain.com
    html2pdf.port: 80

Execute php composer.phar update carlescliment/html2pdf-bundle

Usage

From your controller, render the template and pass it to the service:

class SampleController extends Controller
{
    public function toPdfAction()
    {
        $view = $this->renderView('YourBundle:Sample:toPdf.html.twig');
        $bridge = $this->get('html2pdf.bridge');
        $options = array('footer-left' => 'my footer');
        return $bridge->getFromHtml($view, 'document_name', $options);
    }
}

Testing

Execute phpunit in the bundle's root dir to run the tests.

If you need functional or integration tests and don't want to make real curl requests, you can use the NullProtocol in order to disable them. Put this configuration in your config_test.yml file.

html2pdf.protocol:
    class: carlescliment\Html2PdfServiceBundle\Protocol\NullProtocol

TO-DO

  • Port setting is currently being ignored
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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle