Dompdf重叠图像

时间:2016-12-01 20:10:44

标签: php dompdf

我正在尝试使用In [46]: d[(d.Salary < lower) | (d.Salary > upper)]['Sex'].sum() Out[46]: 1 将产品库图像转换为PDF,但它会重叠图像而不是在下一行显示它们(对于解决方案,我尝试了dompdf但是没有效果我)

<br>

这是css

if(isset($data) && count($data)>0){
$html="<link rel='stylesheet' href='".get_template_directory_uri()."/assets/css/woocommerce.css'>";
$html.="<link rel='stylesheet' href='".get_template_directory_uri()."/style.css'>";
$html.="<div  style='text-align: center;'><h1>".$project_title."</h1><span><h3>".$project_sub_title."</h3></span></div>";
$html.='<div id="pdf_main"><ul class="products clearfix products-3 pdf_class">';
$counter=1;
while  ($data = mysql_fetch_assoc($result)) {
$html.='<li class=" product type-product status-publish has-post-thumbnail product_cat-bedroom  instock shipping-taxable purchasable product-type-simple">
<img src="'.$data['img'].'" class="attachment-shop_catalog size-shop_catalog">
 </a>
 <div class="product-details">
  <div class="product-details-container">
   <h3 class="" data-fontsize="16" data-lineheight="24">'.$data['product_title'].'</h3>
</div>
</div>
</li>';
}
$html.="</ul></div>";
$options = new Options();
$options->set('isRemoteEnabled', true);
$dompdf = new Dompdf($options);
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream('Products.pdf');
$output = $dompdf->output();
}

看到第4张图片是半切,也是第5张没有显示,在我的css中我清理浮动后的第3个产品但是它没有工作和重叠图像

enter image description here

1 个答案:

答案 0 :(得分:0)

经过大量的配音后,我才知道<li>正在自动使用,这就是为什么它过度研磨了。我给它固定的宽度,它正在工作,并显示完美的网格

$html.='<li class=" product type-product status-publish has-post-thumbnail product_cat-bedroom  instock shipping-taxable purchasable product-type-simple">
<img src="'.$data['img'].'" class="attachment-shop_catalog size-shop_catalog">
 </a>
 <div class="product-details">
  <div class="product-details-container">
   <h3 class="" data-fontsize="16" data-lineheight="24">'.$data['product_title'].'</h3>
</div>
</div>
</li>';