Reputation: 77
$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:18mm}',
// set mPDF properties on the fly
'options' => ['title' => 'Title'],
// call mPDF methods on the fly
'methods' => [
// 'SetHeader'=>['Krajee Report Header'],
// 'SetFooter'=>['{PAGENO}'],
],
'marginTop' => 1,
'marginBottom' => 1,
'marginLeft' => 2,
'marginRight' => 0,
]);
Html:
$html = '<style>'. $mystyle .' </style>';
$html .= '<div>' . $mydiv . '</div>';
echo $html;
Trying to print the div with the internal style but the internal style don't seem to work even though div is showing. There is not error shown so is there any chance that it doesn't support internal style? Or did i miss out something?
**Inline style is working
Upvotes: 0
Views: 1055
Reputation: 77
The answer I found to the internal style not working is because whatever I pass to the PDF is read as 'content'. I need to pass the style to 'cssInline' and not 'content'.
Upvotes: 1