meilon / tcpdfbundle
Provides TCPDF integration for Symfony
Installs: 22
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Type:symfony-bundle
Requires
- php: >=5.3.0
- symfony/framework-bundle: >=2.8
- tecnickcom/tcpdf: ^6.2
This package is not auto-updated.
Last update: 2022-02-01 12:55:29 UTC
README
Add IoTcpdfBundle in your composer.json:
{ "require": { "meilon/tcpdfbundle": "dev-master" } }
Now tell composer to download the bundle by running the command:
$ php composer.phar update
Composer will install the bundle to your project's vendor/meilon
directory.
Step 2: Enable the bundle
Enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Io\TcpdfBundle\IoTcpdfBundle(), ); }
HOW TO USE:
Controller: mybundle/controllers/myController.php
class MyController extends Controller { /** * @Route("/mypage.pdf") */ public function mypageAction() { //creating html source $html = $this->renderView('MyBundle:MyController:mypage.pdf.twig', array()); //loading io_tcpdf library $pdf = $this->get('io_tcpdf'); //do your stuff here //display pdf (it returns a Response Object) return $pdf->quick_pdf($html); } }
View: mybundle/Resources/views/myController/mypage.pdf.twig
<div><h1>header</h1></div> <hr /> <div>content</div>
TODO
- smart method for easier PDF generation and customization
- cache pdf generation
- @PDF('template.twig') annotation system