kartik-v / yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.
http://demos.krajee.com/mpdf
Other
163 stars 149 forks source link

YII2 - PDF - Not showing the latest image. #33

Closed sunilsoftkochi closed 5 years ago

sunilsoftkochi commented 8 years ago

In my yii2 project, i'm using kartik\mpdf\Pdf to prepare pdf report. In the application it is not showing the latest image from database and shows only old image. following is the code i made.<?= Html::img(\Yii::$app->urlManager->createUrl(['/site/loadheader', 'id' => $img->COMPANYCODE]),array('width'=>1024,'height'=>174,'alt'=>'Header')); ?>

in the controller i made the following code:-` public function actionPrint($id) { // get your HTML raw content without any layouts or scripts $content = $this->renderPartial('_print',['id' => $id]);

    // setup kartik\mpdf\Pdf 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} ' .
                        '.tbl {border: 1px solid black; border-collapse: collapse} ' .
                        '.tbl-horiz {border-left: 1px solid black; border-right: 1px solid black;} ',
                                       // set mPDF properties on the fly
         'options' => ['title' => ''],
         // call mPDF methods on the fly
         //'methods' => [
         //          'SetHeader'=>[''],
         //          'SetFooter'=>['{PAGENO}'],
         //]
    ]);

    // return the pdf output as per the destination setting
    return $pdf->render();
}

`

friends, please go through this and give me a solution....

shakalvv commented 8 years ago

https://github.com/kartik-v/yii2-mpdf/issues/19#issuecomment-237855233

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.