ITextSharp Error: ARIALUNI.TTF not found as file or resource in hosting server

IamAzhar
 
on Sep 02, 2020 03:43 AM
5227 Views

Error on server

C:\Windows\Fonts\ARIALUNI.TTF not found as file or resource.

BaseFont bf = BaseFont.CreateFont(Environment.GetEnvironmentVariable("windir") + @"\fonts\ARIALUNI.TTF", BaseFont.IDENTITY_H, true);

error comes in this line

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Sep 03, 2020 12:16 AM

Hi IamAzhar,

The font file is not available in the hosting server.

So copy the ARIALUNI.TTF file and save in project folder. Then select the file from the project folder.

string fontPath = Server.MapPath("~/Fonts/");
BaseFont bf = BaseFont.CreateFont(fontPath + "ARIALUNI.ttf", BaseFont.IDENTITY_H, true);

For more details refer below link.

https://stackoverflow.com/questions/22728381/itextsharp-arialuni-ttf-copy-on-hosting-server