Buenos días … llevo poco tiempo trabajando con framework yii
Estoy intentando exportar una pagina php utilizando la extensión kartik/mpdf me da el siguiente error. Les asgradecería mucho si me pueden ayudar a corregirlo…
PHP Fatal Error ‘yii\base\ErrorException’ with message ‘Class ‘mPDF’ not found’ in D:\Ismary\xampp\htdocs\paisajes\vendor\kartik\mpdf\Pdf.php:201 Stack trace: #0 [internal function]: yii\base\ErrorHandler->handleFatalError() #1 {main}
el codigo que utilizo es el siguiente:
en la Vista un botón
<?php echo Html::a(’<i class=“fa glyphicon glyphicon-hand-up”>Exportar Componentes</i> ',
['/componentes/exportar-pdf', 'observacion' => $observacion->id_observacion],
[
'class' => 'btn btn-danger',
'target' => '_blank',
'data-toggle' => 'tooltip',
'title' => 'Generar archivo PDF con las características del Paisaje'
]);?>
En el controlador una función
public function actionExportarPdf($observacion)
{
Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
Yii::$app->errorHandler;
$obs = new Observaciones();
$model = $obs->findOne($observacion);
$lugar = Lugar::findOne($model->id_lugar);
$content = $this->renderPartial('componentes', ['tablaLugar' => $lugar, 'observacion' => $model]);
$pdf = new Pdf([
// set to use core fonts only
'mode' => Pdf::MODE_CORE,
// A4 paper format
'format' => Pdf::FORMAT_A4,
// portrait orientation
'orientation' => Pdf::ORIENT_PORTRAIT,
// stream to browser inline
'destination' => Pdf::DEST_BROWSER,
// your html content input
'content' => $content,
// format content from your own css file if needed or use the
// enhanced bootstrap css built by Krajee for mPDF formatting
'cssFile' => '/css/site.css',
// any css to be embedded if required
'cssInline' => '.kv-heading-1{font-size:18px}',
// set mPDF properties on the fly
'options' => [
'title' => 'Reporte en PDF',
'subject' => 'Generar un archivo PDF'
],
// call mPDF methods on the fly
'methods' => [
'SetHeader' => ['Generar Reporte en PDF' . date("r")],
'SetFooter' => ['|Page {PAGENO}|'],
]
]);
return $pdf->render();
}