Mpdf生成带有样式表的空白pdf



Mpdf在包含样式表时生成空白页pdf,当我删除样式表$mpdf->WriteHTML($stylesheet,1);时工作良好,但我想包含样式表。谢谢你的帮助。

<?php
if(isset($_POST['pdf'])){
ob_clean();
flush();
/*-------------------- for genearte pdf start -----------------*/
include("mpdf/vendor/autoload.php");
include('includes/db.php');

$mpdf = new MpdfMpdf();

//$html = '<h1>Welcome</h1>';
$html = '<div class="table-responsive">
<table class="table table-hover tablesorter pdf_border">
<thead>
<tr class="pdf_border">
<th class="header pdf_border">Name</th>

</tr>
</thead>

<tbody>'; ?>
<?php

$sqli        = "SELECT * FROM user";
$resulti     = mysqli_query($connection,$sqli);
while($row  = mysqli_fetch_assoc($resulti))
{                    
$html .= '<tr class="pdf_border">
<td class="pdf_border">'.$row['name'].'</td>   
</tr>';
} 

$html .= '</tbody></table>'; 
$path       = 'pdf/';
$file_name ="webpreparations-".time().".pdf";
$stylesheet =file_get_contents('css/bootstrap.min.css'); 
$mpdf->WriteHTML($stylesheet,1);  //             
$mpdf->WriteHTML($html,2); 
$mpdf->Output($path.$file_name, "D");
}
?>
<form action="" method="post">
<input type="submit" name="pdf" class="pull-right btn btn-warning btn-large" style="margin-right:40px" value="Genarte PDF">
</form>

和损坏的pdf文件,如果我删除ob_clean(); flush();

使用 添加样式表
$mpdf->WriteHTML('path/your stylsheet.css'), MpdfHTMLParserMode::HEADER_CSS);