The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Currency Symbol having extra spaces when generating a PDF

Rohit_Singh_19
Tera Contributor

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

Rohit_Singh_19_0-1756317211340.png

 

Snip from the Background Script

Rohit_Singh_19_1-1756317260911.png

 

 

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

@Rohit_Singh_19 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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.

@Rohit_Singh_19 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Kinga_Getint
Tera Contributor

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&nbsp;' : currency_symbol}
</span>
<span class="amount">${formatted_amount}</span> 

Kinga_Getint
Tera Contributor

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&nbsp;' : currency_symbol} </span> <span class="amount">${formatted_amount}</span> "