Jump to content

Strip HTML from Invoice PDF


Logman

Recommended Posts

I have successfully stripped HTML from email templates, cart pages and the invoice template. Still have product description HTML in the invoice PDF. Code looks a bit more complex. Tried |unescape after the item description in invoicepdf.tpl but it just removes the whole description. Any ideas?

foreach ($invoiceitems as $item) {
    $tblhtml .= '
    <tr bgcolor="#fff">
        <td align="left">' . nl2br($item['description']) . '<br /></td>
        <td align="center">' . $item['amount'] . '</td>
    </tr>';
}

Link to comment
Share on other sites

1 hour ago, Logman said:

I have successfully stripped HTML from email templates, cart pages and the invoice template. Still have product description HTML in the invoice PDF. Code looks a bit more complex. Tried |unescape after the item description in invoicepdf.tpl but it just removes the whole description. Any ideas?

|unescape would be for Smarty - in this template, you have to think PHP.... changing nl2br to strip_tags would remove all the HTML from the string - but whether you want to do that i'm unsure...

strip_tags(nl2br($item['description']),'<br>')

the above would remove all html from the string apart from new lines/break returns - what HTML are you seeing i that string that you want to remove ?

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