Yii2 TCPDF to load TCPDF libraries in a Yii2 site
- 0.3 - Added example
- 0.2 - Loaded tcpdf_6_0_075
- 0.1 - Initial Releases
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require ahmadhelmy/yii2-tcpdf "dev-master"
or add
"ahmadhelmy/yii2-tcpdf": "dev-master"
to the require
section of your composer.json
file.
- Add in your configuration file, in component section:
'component' => [ ... // Yii2 TCPDF 'tcpdf' => [ 'class' => 'ahmadhelmy\tcpdf\TCPDF', ], ... ]
- Add in your SiteController the action:
public function actionTcpdf() { return $this->render('tcpdf'); }
- Add in your view/site folder the file tcpdf.php from example folder
- Now you can view the example at the links:
- Simple URL: index.php?r=site/tcpdf
- Pretty URL: site/tcpdf
- Load Component Yii2 TCPDF
\Yii::$app->get('tcpdf');
- Insert here your TCPDF Code
...
- Close Yii2
\Yii::$app->end();