Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sunilsoftkochi opened this issue Jun 22, 2016 · 2 comments
Closed

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

sunilsoftkochi opened this issue Jun 22, 2016 · 2 comments
Labels

Comments

@sunilsoftkochi
Copy link

sunilsoftkochi commented Jun 22, 2016

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
Copy link

shakalvv commented Aug 5, 2016

#19 (comment)

@stale
Copy link

stale bot commented May 26, 2019

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.

@stale stale bot added the wontfix label May 26, 2019
@stale stale bot closed this as completed Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants