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

on Sep 02, 2020 03:43 AM

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
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.