pcrt/yii2-latex
Composer 安装命令:
composer require pcrt/yii2-latex
包简介
Alternative Gii generator for Yii2 framework
README 文档
README
Latex2PDF formatter for Yii2 .
This extension "format" Latex responses to PDF files (by default Yii2 includes HTML, JSON and XML formatters). Great for reports in PDF format using Latex views/layouts.
##Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require pcrt/yii2-latex "*"
or add
"pcrt/yii2-pdf": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, modify your application configuration to include:
return [ 'components' => [ ... 'response' => [ 'formatters' => [ 'pdf' => [ 'class' => 'pcrt\latex\Latex2PdfResponseFormatter', 'latexbin' => '/usr/local/bin/pdflatex', 'buildpath' => '/folder/you/prefer' // for default use current folder 'keepfile' => false // if true not clean debug file ( debug purpose only ) ], ] ], ... ], ];
For default the buildpath variable is set on your @webroot folder .
In the controller:
class MyController extends Controller { public function actionPdf(){ Yii::$app->response->format = 'latex'; $this->layout = '//print'; // A siple template without any html code return $this->render('myview', []); } }
License
Yii2-Latex is released under the BSD-3 License. See the bundled LICENSE.md for details.
Useful URLs
Enjoy!
统计信息
- 总下载量: 298
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-01-22