0

I want to implement the function of using css to number the rows of my table automatically in my tcpdf. I do not know why it does not work. I did check it in a regular website it works perfectly. But i do not know why when i added it into my tcpdf it does not work at all. Does anyone know the solution to this problem? Please help me. Any advice will be appreciated. Thanks in advance.

 $htmlcontent .= '<style>
    table {
        counter-reset: rowNumber;
      }
      
      table tr.receiptcontent::before {
        display: table-cell;
        counter-increment: rowNumber;
        content: counter(rowNumber) ".";
      
      }
       </style>';

    $htmlcontent .='
    <table cellpadding="11" style="max-height: 1000px;">
        <tr class="receiptcontent">

            <td colspan="3" style="font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
                '.$irow['product_title'].'
            </td>
            
             <td style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
               '.$irow['product_sku'].'
            </td>
             <td style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
               '.$irow['quantity'].' '.$irow['quantity_unit'].'
            </td>
             <td style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
              RM '.$irow['product_buy_price'].'
            </td>
            <td  width= "20%" style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
                RM '.$irow['purchase_price'].'
            </td>
        </tr>
    </table>

    ';
    }
shining
  • 27
  • 1
  • 6

1 Answers1

0

Inline the CSS while sending the HTML to the TCPDF

or

add your css in a seperate css file and include it in the html:

eg: $htmlcontent .='<style>'.file_get_contents('./style.css').'</style>';