What software do you use to write PDF templates? D...
# advancedpdf
m
What software do you use to write PDF templates? Does anyone use VSCode? Are there any good VSCode extensions?
s
I have been using the FreeMarker extension for VSCode for a while now, and it has been working well: https://marketplace.visualstudio.com/items?itemName=dcortes92.FreeMarker
✔️ 1
The advanced PDF/HTML templates are FreeMarker templates, and are processed by BFO when printed as PDF's
m
I got the FreeMaker ext, but then using the .ftl file extension turns off the auto html formatting.
s
I am thinking back now, and I believe I initially set the extension to
.xml
or
.html
, formatted them in VSCode, then changed the extension to
.ftl
Not sure if there is a better way. It might be possible to configure the XML or HTML formatter to work with other extensions
m
just tried it out again. You can save it as .ftl but then set the formatting to html. That seems to work.
You can "configure fille association for .ftl" to use HTML formatter
s
I may have done that a while ago, since my .ftl files are being auto-formatted. It's been a while since I touched any of the settings.
m
The formatter still doesnt like the freemaker if statements though
s
Yes, I do have problems with those too
You can perform a kind of ternary statement in a single statement. It's fine for relatively simple if-else clauses:
${(record.taxtotal == 0)?string('0.00', record.taxtotal)}
There is also the
?then
built-in, but I haven't tried it to see if it works with the version NetSuite uses
j
What version(s) of FreeMarker does that extension work with? Or is it just a general-case syntax highligher that highlights a common pool of FM reserved words?
s
The documentation doesn't say what version it supports. As for the formatting issue, I wonder if NetSuite supports the alternative square bracket syntax. If so, it might play more nicely with the HTML formatter. I'll have to try that out and see if it works.
m
it formats it well enough in the HTML, but complains a lot when using an if statement in CSS. Is there a better way to use an iff in css?
j
This doesnt sound much better than just having VS Code format it as
html
m
its not. Just adds some snippets and syntax highlighting to the freemarker