Currency Symbol having extra spaces when generating a PDF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi All,
In HR Core Scope I am generating a PDF document from Document Template (sn_doc_template) and using Document Template Script (sn_doc_template_script) where I am pulling up the HR Profile-> Custom Currency Field (reference Field to ->fx_currency) table. I am facing the issue for user having FX Currency only for ILS having currency symbol (₪). The other currency symbol appearing fine in the PDF without an extra space before after the symbol. I have checked there is no space in the Currency symbol field. I have also checked in back ground script to print the value from the symbol and there it does not have any space.
The instance is in Yokohama
Snip from the PDF
Snip from the Background Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
I believe it could be a bug how that the specific currency symbol is handled internally when system generates the PDF.
Since you are using script you can try to manipulate the currency value and try to adjust the string before the PDF is actually generated.
I believe that's the easiest and quickest way to fix as of now.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Ankur Bawiskar , I did try to manipulate the currency symbol value from the script by using variable.trim() but still I am getting the same result. Can you suggest something different which might can help? I am storing the symbol in a variable and then concatenating it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Since you are now doing string manipulation in document template script it should work fine
share that complete script here
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hey @Rohit_Singh_19
Not directly fix, but kind of quick workaround that may be helpful and worth checking:
Render ILS as an ISO code instead of the ₪ glyph, e.g. ILS 1,234.00 (with a non-breaking space).
This completely sidesteps the buggy glyph metrics in the PDF engine/fonts, requires no font uploads, and won’t affect other currencies.
Try with this HTML snippet:
<span class="currency">
${currency == 'ILS' ? 'ILS ' : currency_symbol}
</span>
<span class="amount">${formatted_amount}</span>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hey @Rohit_Singh_19
It's not an exact fix, but may be a quick workaround.
Render ILS as an ISO code instead of the ₪ glyph, e.g. ILS 1,234.00 (with a non-breaking space). This completely sidesteps the buggy glyph metrics in the PDF engine/fonts, requires no font uploads, and won’t affect other currencies.
Try with this HTML snippet:
<span class="currency"> ${currency == 'ILS' ? 'ILS ' : currency_symbol} </span> <span class="amount">${formatted_amount}</span> "