<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style type="text/css" media="all">
.HVMC{font-family: "Herr Von Muellerhoff", cursive !important}
.MDHC{font-family: "Mr De Haviland", cursive !important;}
.ABC{font-family: "Alex Brush", cursive !important;}
.CCC{font-family: "Cedarville Cursive", cursive !important;}
.LBAC{font-family: "La Belle Aurore", cursive !important;}
.img-list {
background-size: contain;
background-position: center;
background-repeat: no-repeat;
position: relative;
width: 100%;
height: 1310px;
}
html,body
{
height: 100%;
margin: 0;
background-color:lightgray;
}
</style>
</head>
<div id="maindiv">
@foreach ($proposalfromTemplate as $proposal)
{!! $proposal->html !!}
@endforeach
<div>
</html>
PDF::setOptions(['isRemoteEnabled' => TRUE, 'enable_javascript' => TRUE]);
$pdf = PDF::loadView('pdfview');
return $pdf->download($pid . '.pdf');
当我返回View时,它工作正常,但是当我返回$ pdf-> download()时,它不包含Blade文件中的CSS给定的数据是我从存储中获取的文本文件,因此无法在其上添加CSS
谢谢
[在加载到DOMPDF之前必须先呈现HTML
public function generateXYZ()
{
PDF::setOptions(['isRemoteEnabled' => TRUE, 'enable_javascript' => TRUE]);
$dompdf = new Dompdf();
$html = view('your.view.path')->render();
$dompdf->loadHtml($page);
$dompdf->render();
return $pdf->download('card.pdf');
}