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
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.

 

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.