php
  • dompdf
  • 2016-12-01 122 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>'; 
    
    相關問題