How do i add css in tcpdf?

I wanted to do auto numbering for my tables with css using TCPDF. I tried both ways but it does not work at all.

I tried the one in the documentation of tcpdf and it does not work too. Can anyone give me a piece of advice on how to make this work?

These are the both ways i mentioned and it did not work.

  $htmlcontent .='
<style>
table {
		  counter-reset: rowNumber;
		}

		table tr::before {
		  display: table-cell;
		  counter-increment: rowNumber;
		  content: counter(rowNumber) ".";
		  padding-right: 0.3em;
		  text-align: right;
		}
</style>
<table id="receiptTable" cellpadding="3" style="max-height: 1000px;">
    <tr>
     <td width = "7%"style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
           
        </td>
    
        <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>

';
}

for this i use the method of including external css into my tables but it does not work as well. I did make sure my file path is correct. (the code below)

$htmlcontent .='
    <style>.file_get_contents(css/receipt.css).</style>
    <table id="receiptTable" cellpadding="3" style="max-height: 1000px;">
        <tr>
         <td width = "7%"style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
               
            </td>
        
            <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>

    ';
    }
Sponsor our Newsletter | Privacy Policy | Terms of Service