New to Telerik Reporting? Download free 30-day trial

The report item is rendered with an incorrect font on the first render in Azure

Environment

Product Progress® Telerik® Reporting
Project Type ASP.NET Core

Description

When viewing a report that is rendered in Azure environment, the font is replaced on the first instance of that report item/section with the default font for the OS. The rest of the report is rendered with the custom font as expected. The same report renders correctly(including the first instance) locally.

Our reporting engine requires the fonts to either be installed in the hosting environment or to be referenced through the use of the privateFonts element.

Installing a font on an Azure app service can sometimes be not an easy task so people end up using the privateFonts variant.

This turns out to also be tricky because the wwwroot folder gets duplicated in Azure Web apps and if the font is in there, that could mess up the path where the reporting engine looks for to find the font.

Steps to Reproduce

Host an .NET Core web application project on Azure, then use it to render a report that display text with custom font.

Solution

  • Ensure that the fonts are present in the wwwroot folder of the project(which is the root folder of the app when it is run in Azure App service)

    "telerikReporting": {
        "privateFonts": [{
            "fontFamily": "ubuntu",
            "path": "Ubuntu-R.ttf",
        }]
    }
    
  • Invoke the UseStaticFiles method at the end of the Configure method in Startup.cs/Program.cs to resolve the wwwroot duplicate problem.

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        ....
        app.UseStaticFiles();
    }
    

See Also

In this article