public function actionImprimir() { // get your HTML raw content without any layouts or scrip $empleados = Empleados::find()->all(); $content = $this->renderPartial('_imprimir', ['empleados' => $empleados]); $header = $this->renderPartial('_header', ['empleados' => $empleados]); $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => $header, 'SetFooter' => ['{PAGENO}']]]); // return the pdf output as per the destination setting return $pdf->render(); }
/** * @return \yii\db\ActiveQuery */ public function getEmpleados() { return $this->hasMany(Empleados::className(), ['estatus_did' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getEmpleadoA() { return $this->hasOne(Empleados::className(), ['id' => 'empleado_aid']); }