PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Rafael Espinosa   mPDF Wrapper   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Auxiliary data
Class: mPDF Wrapper
Compose and generate PDF documents using mPDF
Author: By
Last change:
Date: 9 years ago
Size: 1,104 bytes
 

Contents

Class file image Download

Fluency/mPDF

mPDF wrapper. Check mPDF website for further details

Using in Symfony2

Add the bridge classes to container config.

mPDF container config

<parameters>
    <parameter key="fluency_office.mpdf.factory.class">Fluency\Bridge\MPdf\MPdfFactory</parameter>
    <parameter key="fluency_office.mpdf.provider.class">Fluency\Bridge\MPdf\MPdfProvider</parameter>
</parameters>

<services>
    <service id="fluency_office.mpdf.factory" class="%fluency_office.mpdf.factory.class%"/>
    <service id="fluency_office.mpdf.provider" class="%fluency_office.mpdf.provider.class%">
        <argument type="service" id="fluency_reports.mpdf.factory" />
    </service>
    <service id="mpdf.factory" alias="fluency_office.mpdf.factory"/>
    <service id="mpdf.provider" alias="fluency_office.mpdf.provider"/>
</services>

Generate PDF files from controllers.

$mpdf = $this->get('mpdf.provider');
$mpdf->getMPdfInstance()->WriteHTML(
    'Some HTML Text or $this->render(your_twig_view)->getContent()'
);
return $mpdf->getMPdfResponse();