PHP code example of pcrt / yii2-latex

1. Go to this page and download the library: Download pcrt/yii2-latex library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pcrt / yii2-latex example snippets


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 )
 				],
			]
		],
		...
	],
];


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', []);
	}
}


$ php composer.phar