last day (23 days later) » 

13:07
0
Q: Use roboto font in Yii PDF extension

Gaurav AggarwalI am converting a html to pdf using yii pdf extention but i don't want to use system font i wanna use roboto font in my html but can't able to use external file. I just included this google api for roboto font <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='tex...

don't downvote unnecessary ask if there is some problem or atleast comment whats wrong...
do you want to import font and want to use that fontfamily in your html page ?
yes exactly i want to do this but here i am not able to import any external file no included file is working or if i use font-family:roboto i am getting this error TCPDF ERROR: Could not include font definition file: roboto
TCPDF ERROR , means i think you are adding fort to PDF creation or what ?
fort? please elaborate..
13:07
means what you are generating pdf file with TCPDF and want to add externel fonts in it , that time you will get this type of error ?
So how it is possible?
$font = $pdf->addTTFfont("filename.ttf"); $pdf->SetFont($font,'',10);
where i have to add this?
where you are generating pdf
i have a function in controller
13:08
give me
public function actionGeneratePdf(){

$htmlPdf = $this->renderPartial('testing', null, true);

//$this->generatePdf('test.pdf',$html,'OUTPUT_TO_BROWSER');
$name = 'testing.pdf';
ob_start();
$html2pdf = Yii::app()->ePdf->HTML2PDF();
$html2pdf->setDefaultFont('arial');
$html2pdf->setTestTdInOnePage();
$html2pdf->WriteHTML($htmlPdf);
$html2pdf->Output($name, EYiiPdf::OUTPUT_TO_BROWSER);
$font = $this->addTTFfont("filename.ttf"); $this->SetFont($font,'',10);
ob_end_flush();
exit;
die('sadsd');
}
just added $font line
hey i found this 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', through this i think i can include font css file
but could you please help me where to add it
$html2pdf->addFont($family, $style='', "filename.ttf")
instead
$font = $this->addTTFfont("filename.ttf"); $this->SetFont($font,'',10);
now i am little confused how can font will work just with ttf file and do i need to include this ttf file from local path?
13:16
you should have roboto ttf file
this code will include roboto font in to pdf file
thnku just let me check
and then i can call roboto font in this $html2pdf->setDefaultFont('arial'); ?
and font can be from local path?
yes
this is html2pdf.class
you can check other functions as well
thnku for your regular cooperation may be i am sounding like dumb but i am a html person i have no idea of php
i am including font...will revert
Parse error: syntax error, unexpected 'ob_end_flush' (T_STRING) in C:\xampp\htdocs\insight\insight\protected\controllers\OutletInvoicePaymentPlansC‌​ontroller.php on line 576
this is the error
13:37
why have you used ob_start(); and ob_end_flush();
no idea about it i got this code from my developer
remove both lines and check
nothing happened
well thankyou so much for you support
i signing off now
really appritiated
ok np
welcome
wht do u do?

  last day (23 days later) »