V5 Twig Template: Html as raw string in PDF

When using the “Public Notes” in an invoice, I want to add them to the PDF.

The PDF displays <p>This is the public notes content</p> as raw text.

This is how I add it to a “Template” (Settings > Invoice Design > Custom Designs > Design > Select “Template” and check “invoices” as entity).

<ninja>
	{% set invoice = invoices | first %}
	<div class="container container-text">
		{% if invoice.custom2 %}<h2>{{ invoice.custom2_label }}: {{ invoice.custom2 }}</h2>{% endif %}
		{% if invoice.public_notes %}<div id="notes">{{ invoice.public_notes | raw }}</div>{% endif %}
	</div>
</ninja>

My questions:

  1. Why does it not render as Html (to be converted to a PDF)?
  2. Why does it wrap in a Paragraph-Tag, which might bring some unwanted styling if applied and is easy to wrap anyway by ourselfs?
  3. How do I get the raw string when Twigs raw and striptags functions are not supported?

Thanks in advance.

Hi,

I suggest creating a discussion on GitHub for these questions, or since you’re on the hosted platform feel free to send an email to contact@invoiceninja.com.

I sent you an email. Thanks. Will not mark it as solution as later readers should at least understand that this was solved elsewhere in the end and not abandoned.

1 Like