Javascript not working in print format v14

I do this in version 13 but it doesn’t work in version 14

You can use Jinja in Print Formats

eg: {{ doc.in_words or ‘’ }} if your DocType is “Sales Invoice” and you are trying to get the amount in words

I have also tried this, on the preview doesn’t show anything but when you see on full page it works fine