2017 © Pedro Peláez
 

symfony-bundle mpdf-wrapper

This bundle allows to use mpdf library with symfony3.

image

symfgenus/mpdf-wrapper

This bundle allows to use mpdf library with symfony3.

  • Friday, February 9, 2018
  • by hanishsingla
  • Repository
  • 1 Watchers
  • 1 Stars
  • 33 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

mpdf-wrapper

This bundle provides a service for mpdf library with symfony 4., (*1)

1 Installation

1.1 Download MpdfWrapperBundle using composer

Run in terminal:, (*2)

$ php composer.phar require symfgenus/mpdf-wrapper

1.2 Enable the bundle

Symfony flex activates the bundles automatically. If it is not, then enable the bundle:, (*3)

// /config/bundles.php

    [
        // ...
        Symfgenus\MpdfWrapper\MpdfWrapperBundle::class => ['all' => true],
    ];

2 Usage

MpdfService provides many ways to use MPDF., (*4)

2.1 It can generate a direct pdf response which can be served through any route.

// /config/bundles.php

    public function index(MpdfService $MpdfService)
    {
        return $MpdfService->generatePdfResponse($pdfHtml);
    }

2.2 It can also generate pdf content which can be saved in a variable and used.

// /config/bundles.php

    public function index(MpdfService $MpdfService)
    {
        return $pdf = $MpdfService->generatePdf($pdfHtml);
    }

2.3 Sometimes there is need to create multiple PDFs, MpdfService can be used as following:

// /config/bundles.php

    public function index(MpdfService $MpdfService)
    {
        $firstPdf = $MpdfService->getMpdf($argsFirst);
        $mpdf->WriteHTML($htmlFirst);
        $firstPdfFile = $mpdf->Output();

        $secondPdf = $MpdfService->getMpdf($argsSecond);
        $mpdf->WriteHTML($htmlSecond);
        $secondPdfFile = $mpdf->Output();

        return [
            $firstPdfFile,
            $secondPdfFile
        ];
    }

3 Usage for symfony 3

For symfony 3, this service can be loaded as following:, (*5)

$this->get('symfgenus.mpdf.wrapper').

The Versions

09/02 2018

dev-master

9999999-dev https://github.com/hanishsingla/mpdf-wrapper

This bundle allows to use mpdf library with symfony3.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hanish Singla

symfony2 bundle wrapper symfony3 mpdf

09/02 2018

2.0

2.0.0.0 https://github.com/hanishsingla/mpdf-wrapper

This bundle allows to use mpdf library with symfony3.

  Sources   Download

MIT

The Requires

 

by Hanish Singla

symfony2 bundle wrapper symfony3 mpdf

01/06 2017

1.0.1

1.0.1.0 https://github.com/hanishsingla/mpdf-wrapper

This bundle allows to use mpdf library with symfony3.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hanish Singla

symfony2 bundle wrapper symfony3 mpdf

28/03 2017

1.0.0

1.0.0.0 https://github.com/hanishsingla/mpdf-wrapper

This bundle allows to use mpdf library with symfony3.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hanish Singla

symfony2 bundle wrapper symfony3 mpdf