سلام.
با دستور زیر kartikmpdfPdf رو برای yii2 نصب کردم:
با دستور زیر آن را معرفی کرده ام:
و در متد زیر از آن استفاده کرده ام:
همه اینها را طبق آموزش انجام دادم ولی خطای زیرو میگیرم:
کلاس Pdf که نصب شده، پس چرا خطا میده؟
لطفا راهنمایی کنید.
متشکرم.
با دستور زیر kartikmpdfPdf رو برای yii2 نصب کردم:
1 | composer require kartik-v/yii2-mpdf "dev-master" |
با دستور زیر آن را معرفی کرده ام:
1 | use kartikmpdfPdf; |
و در متد زیر از آن استفاده کرده ام:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | public function actionReport() { // get your HTML raw content without any layouts or scripts $content = $this ->renderPartial( '_reportView' ); // setup kartikmpdfPdf component $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' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css' , // any css to be embedded if required 'cssInline' => '.kv-heading-1{font-size:18px}' , // set mPDF properties on the fly 'options' => [ 'title' => 'Krajee Report Title' ], // call mPDF methods on the fly 'methods' => [ 'SetHeader' =>[ 'Krajee Report Header' ], 'SetFooter' =>[ '{PAGENO}' ], ] ]); // http response $response = Yii:: $app ->response; $response ->format = yiiwebResponse::FORMAT_RAW; $headers = Yii:: $app ->response->headers; $headers ->add( 'Content-Type' , 'application/pdf' ); // return the pdf output as per the destination setting return $pdf ->render(); } |
همه اینها را طبق آموزش انجام دادم ولی خطای زیرو میگیرم:
Class 'kartikmpdfPdf' not found
کلاس Pdf که نصب شده، پس چرا خطا میده؟
لطفا راهنمایی کنید.
متشکرم.