0

i have tried creating pdf files with dynamic content (generated with db data) DomPdf was perfectly working with it. but when i add some addtional section it breaks the content in the middle of div blocks.

So i added page-break-inside: avoid; then that problem solved.

now it makes a blank page after that div element in the pdf document ! Any Solutions? Thanks in advance !

Here is the Code within the php :

 if(mysql_num_rows($get_options_query) > 0){// we have options available

            $color2 = 'f9ebd4';

            $quote_items .= '<div style="page-break-inside: avoid; width: 760px; height: auto;"><div style="width: 760px; height: auto; background-color: #f19221;padding:5px; ">Options:</div>';

            while($get_options = mysql_fetch_array($get_options_query)){

                $prod_opt_col_images='';

                $all_prod_opt_col=$db->get_results("SELECT colour_name, colour_image
    FROM prod_variations
    JOIN prod_colours ON prod_variations.product_colour = prod_colours.colour_name
    WHERE prod_variations.product_id ='".$item['product_id']."'");
        if(count($all_prod_opt_col)>0){
            $prod_opt_col_images='<br />'.'Available in:<br />';
            foreach($all_prod_opt_col as $row_prod_opt_col ){
                $prod_opt_col_images.='<img src="'.URL.'/images/colours/mat/'.$row_prod_opt_col->colour_image.'" width="25" height="25"  alt="'.$row_prod_opt_col->colour_name.'" "/>&nbsp;';
            }
        }

        if($prod_opt_col_images!=''){
            $prod_opt_col_images.='<br />';
        } 



            $quote_items .= '<div class="options" style="background-color: #'.$color2.';">
                    <div class="divCell1">  &nbsp;'.$get_options['qp_prod_qty'].'</div>
                    <div class="divCell2">  &nbsp;'.str_replace("<br>","<br />",$get_options['qp_prod_name']).'<br />'.str_replace("<br>","<br />",$get_options['qp_prod_desc']).$prod_opt_col_images.'</div>
                    <div class="divCell3">  <img src="'.URL.'/images/products/'.$get_options['qp_prod_image'].'" width="75" height="75" alt="Quote Product" /></div>
                    <div class="divCell4"> &nbsp;$'.number_format($get_options['qp_prod_price'],2,'.',',').'</div>
                    <div class="divCell5"> &nbsp;</div>
                </div></div>';


            }   

        }
Cody
  • 905
  • 1
  • 8
  • 14

0 Answers0