symfony-bundle tcpdfbundle
Provides TCPDF integration for Symfony
gonzakpo/tcpdfbundle
Provides TCPDF integration for Symfony
- Thursday, October 24, 2013
- by gonzakpo
- Repository
- 1 Watchers
- 0 Stars
- 329 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 18 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
How to Install
Installation
Using composer
Add following lines to your composer.json
file:, (*1)
Symfony 2.3.*
"require": {
...
"gonzakpo/tcpdfbundle": "dev-master"
}
Execute:, (*2)
php composer.phar update "gonzakpo/tcpdfbundle"
Add it to the AppKernel.php
class:, (*3)
// ...
new Io\TcpdfBundle\IoTcpdfBundle(),
No Using composer
-
Download TCPDF library at http://sourceforge.net/projects/tcpdf/files/
and put it in vendor folder, (*4)
-
Add this bundle to your vendor/ dir, (*5)
-
Vendor Mode
Add the following lines in your deps file::, (*6)
[IoTcpdfBundle]
git=git://github.com/ioalessio/IoTcpdfBundle.git
target=/bundles/Io/TcpdfBundle, (*7)
Run the vendor script:, (*8)
./bin/vendors install, (*9)
-
Add the "Io" namespace to your autoloader:, (*10)
// app/autoload.php
$loader->registerNamespaces(array(
'Io' => __DIR__.'/../vendor/bundles',
// your other namespaces
));
//in same file include tcpdf library
require_once __DIR__.'/../vendor/tcpdf/tcpdf.php';
-
Add the "Io" namespace to your kernel:, (*11)
// app/ApplicationKernel.php
public function registerBundles()
{
return array(
// ...
new Io\TcpdfBundle\IoTcpdfBundle(),
// ...
);
}
HOW TO USE:
//in mybundle/controllers/myController.php
class MyController extends Controller
{
/**
* @Route("/mypage.pdf")
*/
public function mypageAction()
{
$html = $this->renderView('MyBundle:MyController:mypage.pdf.twig', array());
//io_tcpdf will returns Response object
return $this->get('io_tcpdf')->quick_pdf($html);
}
}
//in mybundle/Resources/views/myController.pdf.twig
put here your html code
TODO
- smart method for easier PDF generation and customization
- cache pdf generation
- @PDF('template.twig') annotation system
dev-master
9999999-dev
Provides TCPDF integration for Symfony
Sources
Download
LGPL
The Requires
by
Gergely Polonkai
by
Alessio
pdf
tcpdf
dev-patch-1
dev-patch-1
Provides TCPDF integration for Symfony
Sources
Download
LGPL
The Requires
by
Gergely Polonkai
by
Alessio
pdf
tcpdf