Aspose.PDF for .NET Core 3.1 unable to print INR currency icon

Hi,

We are using Aspose.PDF (Licensed version) in our .Net Core 3.1 application. Generating reports in pdf. Trying to print currency value along with other texts. We can see $ dollar icon in the generated pdf but INR icon is missing and instead a square type symbol getting printed.

This issue comes when we run application in Docker on Windows/Linux both. But when we run it on local iis/api it’s working and icon getting printed there.

We added fonts and culture info related libs in Dockerfile:
RUN sed -i’.bak’ ‘s/$/ contrib/’ /etc/apt/sources.list
RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig

Below is the code snapshot. Please suggest.

this.AddRows(leftDataTable, “Amount”, $"{this.GetCurrencyIcon(data.Amount.CurrencyType)}{this.AmountFormatting(data.Amount.Value)}");

private void AddRows(Table table, string tagLabel, string value)
{
Row row = table.Rows.Add();
row.Cells.Add(tagLabel, this.TextStateRegular);
row.Cells.Add(value ?? string.Empty, this.TextStateRegular).Alignment = HorizontalAlignment.Right;
MarginInfo margin = new MarginInfo();

        margin.Right = 40f;

        row.Cells[1].Margin = margin;
        this.AddEmptyRow(table);
    }

private string GetCurrencyIcon(string currencyType)
{
this.logger.LogDebug(“GetCurrencyIcon: Start”);
var currencyValue = string.Empty;
if (string.IsNullOrEmpty(currencyType))
{
currencyType = WireLabelConstant.DefaultCurrencyType;
}

        var currencyList = CultureInfo
           .GetCultures(CultureTypes.AllCultures)
           .Where(c => !c.IsNeutralCulture)
           .Select(culture =>
           {
               try
               {
                   return new RegionInfo(culture.Name);
               }
               catch
               {
                   return null;
               }
           })
           .Where(ri => ri != null)
           .GroupBy(ri => ri.ISOCurrencySymbol)
           .ToDictionary(x => x.Key, x => x.First().CurrencySymbol);

        this.logger.LogDebug($"GetCurrencyIcon: Currency list {currencyList?.Count}");
        if (currencyList != null)
        {
            currencyValue = currencyList.Where(x => x.Key == currencyType).Select(x => x.Value).FirstOrDefault();
        }

        this.logger.LogDebug($"GetCurrencyIcon: Currency type {currencyType}, Currency value {currencyValue}");
        return currencyValue;
    }
}

@shekumar

As you have shared that the issue is not reproduced when using same application on local machine but getting reproduced when hosted on Docker. This apparently means that there seems to be font related issue on docker for Indian Rupee font. Can you please ensure the fonts availability on docker for used fonts.

There is no specific fonts we installed on local machine (Windows 10) where it’s working. And we added the fonts in Dockerfile (Linux Alpine):

RUN sed -i’.bak’ ‘s/$/ contrib/’ /etc/apt/sources.list
RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig