|
| 1 | +--- |
| 2 | +title: FAQ about using XlsIO in Linux | Syncfusion |
| 3 | +description: This page explains about the frequently asked questions about using the .NET Excel (XlsIO) library in Linux environment. |
| 4 | +platform: document-processing |
| 5 | +control: XlsIO |
| 6 | +documentation: UG |
| 7 | +--- |
| 8 | + |
| 9 | +# Frequently asked questions about using XlsIO in Linux |
| 10 | + |
| 11 | +The frequently asked questions about using XlsIO in Linux environment are listed below. |
| 12 | + |
| 13 | +## How to copy necessary fonts to Linux containers? |
| 14 | + |
| 15 | +Excel to PDF conversion on Linux relies on system fonts available inside the container. By default, only a limited set is installed. Copy the required fonts to "/usr/local/share/fonts/" before conversion. Refer to the steps below to copy fonts. |
| 16 | + |
| 17 | +**Steps:** |
| 18 | + |
| 19 | +Step 1: Create a **Fonts** folder inside your project (or next to the solution). |
| 20 | +Step 2: Place the required TrueType/OpenType font files (.ttf/.otf) in that folder. |
| 21 | +Step 3: Add the following to your Dockerfile to copy the fonts to the container. |
| 22 | + |
| 23 | +{% tabs %} |
| 24 | + |
| 25 | +{% highlight Dockerfile %} |
| 26 | + |
| 27 | +COPY ["ProjectName/Fonts/*.*", "/usr/local/share/fonts/"] |
| 28 | + |
| 29 | +{% endhighlight %} |
| 30 | + |
| 31 | +{% endtabs %} |
| 32 | + |
| 33 | +You can download a complete working sample from <a href="https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Linux/Copy%20fonts%20to%20linux%20containers/.NET/Copy_fonts_to_linux_containers">GitHub</a>. |
| 34 | + |
| 35 | +## How to install Microsoft compatible fonts on Linux? |
| 36 | + |
| 37 | +By default, Linux systems include a limited set of fonts located at "/usr/share/fonts/". For document conversion scenarios that require Microsoft-compatible fonts, you can install them using the following command: |
| 38 | + |
| 39 | +{% tabs %} |
| 40 | + |
| 41 | +{% highlight Kconfig %} |
| 42 | +sudo apt-get install ttf-mscorefonts-installer |
| 43 | +{% endhighlight %} |
| 44 | + |
| 45 | +{% endtabs %} |
| 46 | + |
| 47 | +After installation, the fonts will be available at "/usr/share/fonts/truetype/msttcorefonts", and will be used during conversion. |
| 48 | + |
| 49 | +N> Ensure you have obtained the appropriate license clearance from Microsoft before using these fonts in your environment. |
| 50 | + |
| 51 | +## How to install necessary fonts in Linux containers? |
| 52 | + |
| 53 | +In Excel to PDF conversion, Essential<sup>®</sup> XlsIO uses the fonts installed in the production environment to measure and render text. If a required font is missing, an alternate font will be used based on the environment, which may affect layout fidelity. |
| 54 | + |
| 55 | +To ensure proper font preservation, install all fonts used in the Excel document within the container. |
| 56 | + |
| 57 | +Use the following code snippet to install fonts in containers. |
| 58 | + |
| 59 | +{% tabs %} |
| 60 | + |
| 61 | +{% highlight Dockerfile %} |
| 62 | +RUN apt-get update -y && \ |
| 63 | + apt-get install -y fontconfig debconf && \ |
| 64 | + echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections && \ |
| 65 | + apt-get install -y \ |
| 66 | + fonts-arphic-ukai \ |
| 67 | + fonts-arphic-uming \ |
| 68 | + fonts-ipafont-mincho \ |
| 69 | + fonts-ipafont-gothic \ |
| 70 | + fonts-unfonts-core \ |
| 71 | + ttf-wqy-zenhei \ |
| 72 | + ttf-mscorefonts-installer && \ |
| 73 | + fc-cache -fv && \ |
| 74 | + apt-get clean && \ |
| 75 | + apt-get autoremove -y && \ |
| 76 | + rm -rf /var/lib/apt/lists/* |
| 77 | +{% endhighlight %} |
| 78 | + |
| 79 | +{% endtabs %} |
| 80 | + |
| 81 | +If font preservation issues persist after installing the required packages, you can manually copy the necessary font files into the container. |
| 82 | + |
| 83 | +## How to set culture/locale in Docker containers (Windows and Linux)? |
| 84 | + |
| 85 | +By default, Culture/Locale that is specified in the container image will be used in Docker containers. |
| 86 | + |
| 87 | +If you want to change or set Culture/Locale in the Docker container, set the required Culture/Locale in Docker file. |
| 88 | + |
| 89 | +T> We recommend you check whether the required Culture/Locale is set to the Docker containers since some Docker container may not have Culture/Locale. |
| 90 | + |
| 91 | +The following code example will set en_US locale to the container by setting Language to en_US. |
| 92 | + |
| 93 | +{% tabs %} |
| 94 | + |
| 95 | +{% highlight Dockerfile %} |
| 96 | +ENV LANG="en_US.UTF-8" |
| 97 | +{% endhighlight %} |
| 98 | + |
| 99 | +{% endtabs %} |
| 100 | + |
| 101 | +## How to resolve LibSkiaSharp not found exception? |
| 102 | + |
| 103 | +This exception occurs when required native dependencies are missing. Ensure the necessary packages are installed by adding this to your Docker file: |
| 104 | + |
| 105 | +{% tabs %} |
| 106 | + |
| 107 | +{% highlight Dockerfile %} |
| 108 | +RUN apt-get update -y && apt-get install libfontconfig -y |
| 109 | +{% endhighlight %} |
| 110 | + |
| 111 | +{% endtabs %} |
| 112 | + |
| 113 | +In production environment (hosted server machine), ensure whether the Visual C++ Redistributable is properly installed. |
| 114 | + |
| 115 | +[Download](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170) and install Visual C++, if not installed. |
0 commit comments