Jump to content

PDF Invoice custom html text


zazups

Recommended Posts

Hi there guys,

 

I want to modify a little bit, my pdf invoice by adding two paragraphs of html text in the footer of my pdf invoice, just before the generation date. How can i do that without using Custom Pdf Invoice addon.

 

I'm waiting for your respone. Thx in advance!

Link to comment
Share on other sites

$pdf->SetFont('freesans','',7);

$termshtml = '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0">
   <tr height="30" bgcolor="#efefef">
       <td width="100%">Insert your text here</td>
   </tr></table>';

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

$pdf->Ln(5);

# Generation Date
$pdf->SetFont('freesans','',;
$pdf->Ln(5);
$pdf->Cell(180,4,$_LANG['invoicepdfgenerated'].' '.getTodaysDate(1),'','','C');

top line sets the font size, so if it's too small increase the number... table may have a grey background, if not wanted just remove the bgcolor bits.

Link to comment
Share on other sites

Ok. thx man. it worked.

 

Now i want this custom html text to apper when the invoice status in UNPAID and another custom html text when the invoice status in PAID.

 

In my invoicepdf.tpl file i've added this code but in front of generation date code it seems to be not working:

 

if ($status!="Paid") {

$pdf->SetFont('freesans','',7);

 

$termshtml = '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0">

<tr height="30" bgcolor="#efefef">

<td width="100%">Insert your text here</td>

</tr></table>';

 

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

 

$pdf->Ln(5);

 

}

 

What is the problem? I've done something worng?

Link to comment
Share on other sites

it probably just needs "==" instead of "=".... we use a similar technique on our pdf invoices where the due date is in red on the unpaid invoice and black when its paid.

 

if ($status=="Paid") { 
$termshtml = '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0">
   <tr height="30" bgcolor="#efefef">
       <td width="100%">Insert your PAID text here</td>
   </tr></table>';
}
else
{
$termshtml = '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0">
   <tr height="30" bgcolor="#efefef">
       <td width="100%">Insert your UNPAID text here</td>
   </tr></table>';
}

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

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