I seem to be stuck, and not sure how to resolve th...
# advancedpdf
s
I seem to be stuck, and not sure how to resolve this. I am trying to localize a scripted email message. My idea was to try and use the
nstranslation
module to retrieve localized strings in a template. However, it doesn’t seem to work at all in a regular email template. I am trying instead to use an advanced HTML template file, but I want to render it as HTML, not as a PDF, and I am trying to use
renderer.renderAsString()
, but that just gives me the content of the template (including the pdf tags), but with all freemarker variables removed. Is there a way to print an advanced template from a file to HTML, or is there a better way to send localized versions of emails than this approach? Thanks!
đź‘€ 1
m
My understanding of Advanced PDF/HTML Templates is that if the output is html it just runs freemarker part and find/replaces
<pdf>
with
<html>
etc.
s
When I use the following as my template content:
The output of
renderer.renderAsString()
is just this (the translation strings are not inserted):
But
renderer.renderAsPdf()
displays the translated content:
We’ve attached a copy of your current statement for your reference.
If you’ve already sent us your payment, thank you!
Wir helfen Ihnen gerne!
Vielen Dank
The output of
renderAsString
doesn’t even change the pdf tags to html, so I get the feeling it’s not the right method to use. But, the only function I see that produces HTML output is
renderer.renderToResponse({ response })
, but that requires a http.ServerResponse input parameter, and this is a server side script (Map/Reduce). Is there any way to produce HTML output directly in a server script?
So far, the only solution I have found is to make a separate Suitelet using
renderer.renderToResponse
which feels like a hack, however it does work.