PDF templates: parse HTML code from database field

I’d like to use HTML snippets saved in a database field for inclusing in PDF-templates.
When I do this, it prints the full HTML code into the PDF as text instead of interpreting the HTML tags.

Could could I have the field contents interpreted as HTML, as if it were HTML-code in the PDF template itself?

I’m thinking maybe theres a way to get certain fields parsed differently via the templateParser.php script.
But how could I influence how these fields are parsed?

thanks for your help!

It looks like function WriteText() in mpdf.php might do the trick:

function WriteText($x,$y,$txt) {
	// Output a string using Text() but does encoding and text reversing of RTL

https://mpdf.github.io/write-directly-to-document/direct-writing-to-document.html#direct-writing-methods-and-otl-updated-mpdf--60

But how could I have this used for specific fields when creating a PDF?