I'm trying to bring a string containing HTML tags ...
# advancedpdf
c
I'm trying to bring a string containing HTML tags into a PDF template and have the HTML tags render. This string is coming from a JSON object that I ?eval-ed from a long text field. So if I had a string containing
<b>Foo</b>
I would want it to render as
Foo
instead of
<b>Foo</b>
. It's currently rendering as the latter. Is there a way to fix this? If I add
${"<b>Foo</b>"}
directly to the template it renders as
Foo
which is what I'm trying to do.
question not answered 1
d
I think maybe the string built-in ?interpret may work for your situation
c
Thanks David, unfortunately I'm getting the following error
Copy code
The template cannot be printed due to the following errors: Error on line 41, column 29 in template. Detail... For "${...}" content: Expected a string or something automatically convertible to string (number, date or boolean), or "template output" , but this has evaluated to a transform (wrapper: f.c.Interpret$TemplateProcessorModel): ==> remittancedetails?interpret [in template "template" at line 41, column 31] ---- FTL stack trace ("~" means nesting-related): - Failed at: ${remittancedetails?interpret} [in template "template" at line 41, column 29]
d
Did you assign the result of
remittancedetails?interpret
and then call it like the example?
Copy code
<#assign inlineTemplate = templateSource?interpret>
<@inlineTemplate />
c
I tried the example below. The error is gone, but I'm still getting
<b>Foo</b>
Copy code
<#assign inlineTemplate = remittancedetails?interpret>
<@inlineTemplate />
🤔 1
d
I'm out of ideas on it then, sorry
c
The best that I could do was something like this:
Copy code
<#assign contents = "Foo" />
${"<b>" + contents + "</b>"}
Complex HTML strings would be difficult. I ultimately decided to go a different route. I just thought I would put it out there if anyone runs into this issue in the future and has exhausted all their options.