darsadask
(Darsadask)
June 24, 2013, 10:20am
1
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’);
$mPDF1->WriteHTML($stylesheet, 1);
but pdf generate without any style… Can anyone help me??
or how can i pass style sheet as a parameter in controller
mmbalaa
(Mmbalasundaram)
June 24, 2013, 10:56am
2
design the html file and convert into pdf. include your css in viewfile
html2pdf
darsadask
(Darsadask)
June 24, 2013, 11:30am
3
I included the css file in css folder… You mean i need to include the file in protected/views/myview
mmbalaa
(Mmbalasundaram)
June 24, 2013, 1:03pm
4
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.
outrage
(Site Sense Web)
June 25, 2013, 1:38am
5
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.
mmbalaa
(Mmbalasundaram)
June 25, 2013, 11:45am
6
I tried to apply style for pdf using stylesheet. But pdf not affected. So i included styles in view page. See demo
html2pdf demo
yogi123
(Yogesh D)
July 18, 2014, 12:21pm
7
I have problem in generation of Yii pdf, I done all the process but it shows this error…
Error 500
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?