HostinPK Posted January 1, 2021 Share Posted January 1, 2021 Hello Everyone, I want to add simple HTML table footer to invoice + PDF. I tried creating invoicepdffooter.tpl and added a simple html table code but when I click on download button, it shows the coding (instead of PDF) Can anyone help me in this regard? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted January 1, 2021 Share Posted January 1, 2021 (edited) 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 January 1, 2021 by Kian 0 Quote Link to comment Share on other sites More sharing options...
Solution brian! Posted January 1, 2021 Solution Share Posted January 1, 2021 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, ''); 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. 1 Quote Link to comment Share on other sites More sharing options...
HostinPK Posted January 1, 2021 Author Share Posted January 1, 2021 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, ''); 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 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.