Pdf generation extension in yii not support style sheet? I want to generate a pdf doc with a template design. How can i access style sheet for that template in yii?? I am using mpdf extension. please help me
I include the file name as
<link rel="stylesheet" type="text/css" href="<?php// echo Yii::app()->request->baseUrl; ?>/css/style.css" media="screen, projection" /> in pdf generated page but its not working so am included a line of code in its controller like:
$stylesheet = file_get_contents(Yii::getPathOfAlias(‘webroot.css’) . ‘/style.css’);
but pdf generate without any style… Can anyone help me??
or how can i pass style sheet as a parameter in controller
design the html file and convert into pdf. include your css in viewfile
I included the css file in css folder… You mean i need to include the file in protected/views/myview
using html2pdf file, i got the pdf files.
I work out only for single page so i added the css style in same view file. I used internal styles instead of external style sheet.
I’ve had problems with PDF generation in the past.
It was always a path issue which I fixed by using something like this:
<img src="<?php echo Yii::getPathOfAlias('webroot'); ?>/images/CompanyProfilesImage.jpg" alt="" />
Instead of this:
<img src="<?php echo Yii::app()->baseUrl; ?>/images/CompanyProfilesImage.jpg" alt="" />
Same for your css.
Give it a go.
I tried to apply style for pdf using stylesheet. But pdf not affected. So i included styles in view page. See demo
I have problem in generation of Yii pdf, I done all the process but it shows this error…
Alias "ext.yii-pdf.EYiiPdf" is invalid. Make sure it points to an existing PHP file and the file is readable.
Can You Help me?