php - dompdf 不使用 barryvdh/laravel-dompdf 加载 bootstrap css

标签 php laravel laravel-5

我在laravel 5.5和bootstrap css中使用barryvdh/laravel-dompdf(通过小的调整重命名为pdf.css)以pdf格式生成报告
这是我从报告 View 中调用 css 的标题:

<!DOCTYPE html>
 <html lang="en">
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>  
     <link href="{{public_path('css/pdf.css') }}" rel="stylesheet" type="text/css" />            
</head>
<body>   
我的 Controller :
 public function infor(News $news)
    {   

        ...     
        PDF::setOptions(['dpi' => 150, 'defaultFont' => 'sans-serif']);         
        $pdf = PDF::loadView('admin.news_events.pdf');            
        return $pdf->stream('pdfview.pdf');
   
}
预期 View (html5):
enter image description here
以 pdf 格式生成的 View :,(
enter image description here
我怎么能解决这个问题?

最佳答案

您必须将所有 css 文件放在 style 标签中才能启动您的代码

关于php - dompdf 不使用 barryvdh/laravel-dompdf 加载 bootstrap css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48760296/

相关文章:

php - 如何在 Laravel 中将时间作为输入?

php - 无法将表信息保存到MySQL

php - Eloquent 限制关系字段

php - 通过在 L5 中点击浏览器上的后退按钮来防止注销后重新登录?

Laravel 9 访问 AWS S3 - UnableToWriteFile 位置

php - 许多方法参数与批量参数

php - Laravel ajax 404 未找到错误

PHP 构造函数调用自身 - 不是递归

php - 如何修复 inlcude_once 在 Dreamweaver 中将 php 显示为仅输出错误?

PHP - 从 sql 数据库调用的数组不能正确分解,但直接创建的数组可以吗?