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....
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.
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]);
`
friends, please go through this and give me a solution....