pcrt/yii2-latex Alternative Gii generator for Yii2 framework

Yii2-Latex

  1. Installation
  2. Usage
  3. License

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!

0 0
1 follower
270 downloads
Yii Version: 2.0
License: BSD-3-Clause
Category: Others
Developed by: Protocolli Creativi
Created on: Feb 27, 2019
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions