Jump to content

Want to add a simple HTML footer to invoice + PDF


HostinPK
Go to solution Solved by brian!,

Recommended Posts

Make sure you used TCPDF syntax. invoicepdffooter.ppl doesn't use Smarty. Something like follows.

$pdf->Ln(-5);
$pdf->SetFont($pdfFont, '', 6);
$pdf->MultiCell(140, 5, 'The cat is on the table', 0, 'C', '', 1, 35, '', true);

 

Edited by Kian
Link to comment
Share on other sites

  • Solution

it's going to need <?php at the beginning - otherwise you will get errors...

... and if you wanted to use a html table...

<?php

$pdf->Ln(-5);
$pdf->SetFont($pdfFont, '', 6);
$tblhtml = '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0">
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;text-align:center;">
        <td width="25%">there</td>
        <td width="25%">are</td>
        <td width="25%">four</td>
        <td width="25%">boxes</td>
    </tr>
</table>';
$pdf->writeHTML($tblhtml, true, false, false, false, '');

UkTPp7R.png

one other important thing to mention - if you are using a child theme, then this template file must go in the child theme folder....  the invoice docs say that the file must be in the same folder as invoicepdf.tpl, but if I do that using a child theme, I get a blank PDF... with the invoicepdffooter template in the child theme, it seems to work.

Link to comment
Share on other sites

1 hour ago, brian! said:

it's going to need <?php at the beginning - otherwise you will get errors...

... and if you wanted to use a html table...


<?php

$pdf->Ln(-5);
$pdf->SetFont($pdfFont, '', 6);
$tblhtml = '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0">
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;text-align:center;">
        <td width="25%">there</td>
        <td width="25%">are</td>
        <td width="25%">four</td>
        <td width="25%">boxes</td>
    </tr>
</table>';
$pdf->writeHTML($tblhtml, true, false, false, false, '');

UkTPp7R.png

one other important thing to mention - if you are using a child theme, then this template file must go in the child theme folder....  the invoice docs say that the file must be in the same folder as invoicepdf.tpl, but if I do that using a child theme, I get a blank PDF... with the invoicepdffooter template in the child theme, it seems to work.

Thank you very much for your guidance. I have added the table in footer using above method

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated