Bootstrap 在 pdf 中不起作用 [英] Bootstrap not working inside pdf
本文介绍了Bootstrap 在 pdf 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的控制器代码
公共函数 actionPrint_death_certificate1(){$this->layout = '证书';$html = $this->render('test');require_once(Yii::$app->basePath ."/../vendor/mpdf/mpdf/mpdf.php");$mpdf=new mPDF();$mpdf->WriteHTML($html);$mpdf->输出();}
我的观点
<div class="row"><div class="col-md-6">标题1<div class="col-md-6">标题2
现在我得到了一个 pdf,其中的标题 1 和标题 2 位于两条不同的行中.引导程序不起作用.我错过了什么吗?
return $this->render('test');
当我尝试这个时,它正在工作,heading1 和heading2 排成一行.在 pdf 中它不起作用
解决方案
我在 github 中发布了一个问题,mpdf 人员告诉 mpdf 内bootstrap 不支持开箱即用,而你有使用一些自定义样式.Github 链接
This is my controller code
public function actionPrint_death_certificate1()
{
$this->layout = 'certificate';
$html = $this->render('test');
require_once(Yii::$app->basePath . "/../vendor/mpdf/mpdf/mpdf.php");
$mpdf=new mPDF();
$mpdf->WriteHTML($html);
$mpdf->Output();
}
My view
<div class="container">
<div class="row">
<div class="col-md-6">
Heading1
</div>
<div class="col-md-6">
Heading2
</div>
</div>
</div>
Now i get a pdf with heading1 and heading2 in two different lines. Bootstrap is not working. Am i missing something?
return $this->render('test');
When i tried this one it is working and heading1 and heading2 is coming in one line. In pdf it is not working
解决方案
I posted an issue in github and mpdf guys told that bootstrap not supported out-of-the-box inside mpdf and you have to use some custom style. Github link
这篇关于Bootstrap 在 pdf 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!