dwagner003
dwagner003

Reputation: 21

How to have Aspose.Cells 19.10 correctly render fonts in Linux .Net Service?

I am building a .net service in docker that will take .xlsx files and render them as .tiff. When I run my service locally on a windows environment the images correctly render with Times New Roman text. When I spin up a docker container and submit the same file it returns a blank .tiff image.

I have tried numerous approaches to have Aspose.Cells work correctly in the docker container based off the Aspose documentation relating to setting the default font source, default font folder, and font substitution but none of the suggested methods work. Below I listed the approach that I believe should work with Aspose.Cells

  1. Installed fonts-liberation fontconfig and ttf-mscorefonts-installer on the docker container to get access to fonts located in /usr/share/fonts/truetype/
  2. In the service I have set my source to the following: FontConfigs.SetFontFolder("/usr/share/fonts/truetype/", true); The true in this statement will scan subfolders to find the .ttf font files. I expect Aspose to use this file path in the docker container to get needed fonts for rendering.
  3. I verified that I have fonts available in the "/usr/share/fonts/truetype/" folder under sub-folders of liberation and msttcorefonts.

Can anyone offer advice of another approach or potential issue I am running into? I can provide more information if needed as well.

Upvotes: 2

Views: 1026

Answers (1)

Amjad Sahi
Amjad Sahi

Reputation: 1931

Well, there are some guidelines using Aspose.Cells (especially for rendering features) to work on docker container or similar environments which you should refer to. We also recommend you to kindly try using latest version/fix (e.g Aspose.Cells v20.3) Here are our steps:

The docker we used was: microsoft/dotnet, install it first:

sudo docker pull microsoft/dotnet

When running it, we got an issue in this docker when saving to PDF or image. We did the following things to sort it out:

We installed libgdiplus:

apt-get update
apt-get install -y libgdiplus
cd /usr/lib && ln -s libgdiplus.so gdiplus.dll

And install libc6-dev:

apt-get install -y --no-install-recommends libc6-dev

Hope, this helps a bit.

PS. I am working as Support developer/ Evangelist at Aspose.

Upvotes: 0

Related Questions