php
  • dompdf
  • 2016-12-01 131 views 2 likes 
    2

    我想一个产品画廊图像转换成使用dompdf PDF,但它而不是重叠显示他们对下一行的图像(该解决方案,我想<br>还,但对我没有工作)DOMPDF重叠图像

    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(); 
    } 
    

    这里是CSS

    .products li.product { background-color: transparent; } 
    .products-3 > li:nth-child(3n+1) { clear: both; content: " "; display: block;} 
    .products li { border-color: #ebeaea;} 
    .products-3 > li { float: left; margin-bottom: 11px; margin-right: 1%; width: 32.6%;} 
    .products > li { -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: #efefef; border-image: none; border-style: solid; border-width: 1px 1px 2px;} 
    .product { position: relative;} 
    

    见第4图像I歌唱了半切,也第五届没有显示在我的CSS我正在3产品后清除浮动,但其没有工作,在研磨图像

    enter image description here

    +1

    你能张贴你的CSS? –

    +0

    @ChrisHappy我已添加css –

    回答

    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>'; 
    
    相关问题