Jump to content

TCPDF and table cell widths


tommy2shoes

Recommended Posts

I am trying to get a table using tcpdf which will act as an invoice. Whatever I seem to change the column widths seem to stay the same and look equally divided across the table. I'm sure the fix is simple but I've no idea what it is. Any ideas?

 

Part of the code is:

 

$apname <br>

$address<br><br>

 

Your ref: $matter<br>

Your vat number: $vat<br><br><br>

<table width='800' border='0'>

      <tr>

        <td width='232'>PRODUCT/SERVICE</td>

        <td width='400'>DESCRIPTION</td>

        <td width='75'>UNIT PRICE (£)</td>

        <td width='75'>LINE TOTAL (£)</td>

      </tr>

      <tr>

        <td>Process Agent Appointment</td>

        <td>Letter of Confirmation $idcode</td>

        <td width='75'>500 (£)</td>

        <td width='75'>500 (£)</td>

      </tr>

</table>

 

";

 

// output the HTML content

 

$pdf->writeHTML($htmlcontent, true, false, false, false, '');

Link to comment
https://forums.phpfreaks.com/topic/232729-tcpdf-and-table-cell-widths/
Share on other sites

Thank you. I can't see anything wrong either. I've tried removing the width and that makes no difference. If I change the ' to " I get an error - Parse error: syntax error, unexpected T_LNUMBER. (Am using Dreamweaver for this)

 

Hence I'm a bit stuck. Thanks anyway.

 

You're getting the error because your string is delimitted using double quotes, so you'd have to escape them all which is a major pita.

 

You can get around this (while still preserving interpolation inside the string, by using a heredoc.

 

$somevar = //... all your markup including variables, and double quotes is fine

HERE;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.