Font issue in server while PDF generation but not in local machine
I am generating PDF from HTML. The tool which i am using for html to PDF generation is TallComponent PDFKit4.0.
When PDF is generated in server,index out of range exception is thrown. After analysis i found out due to Unicode character the issue is thrown, but with same unicode character the error is not thrown in local machine.
My question is why it is not throwing same error in my local machine but only in server. To analyze this i have compared available fonts in server and local.
In server 153 fonts are available in C:\Windows\Fonts folder. In my local machine 250 fonts are available.
I have tried to copy paste few fonts from my local to UAT server according to below link, but still it is not working.
The below comma in one of the address filed in html file is causing the issue. The 3rd party tool is too sensitive to this font.
I have tried below sites to find out what font the comma is, https://www.myfonts.com/WhatTheFont/ and i have installed that font in server, error not solved.
I am not sure how i can narrow down the analysis to solve the issue. Since my local doesnot have problem, but server throwing error, I need to find out what is the exact cause and resolve soon as this is production bug.
Currently to resolve this issue am doing data patch in production server to update the unicode comma with normal comma. But i want to fix this permanently.
Any help would be greatly appreciated.
After long analysis, found answer myself.
Generally the problem might be related to Font missing in the server or language pack which was chosen under control panel -> region ->language.
The font Arial Unicode MS Regular was missing in our server, after installing the font and reset IIS, am able to download PDF document without any issues.
Steps taken to resolve the issue:
- Compare how many fonts available in server and local.
- Copy paste unicode character to Microsoft Word and check what is the font type MS word says.
- Download that font from internet or take it from your local machine if it present.
- Install the font and verify
To install the font just double click the font file and click install button. Drag and drop also will do the installation.
This may helpful to narrow down the issue.