Skip to content

How to use NPOI on Linux

Tony Qu edited this page Jan 29, 2023 · 9 revisions

Since NPOI 2.6.0, System.Drawing.Common is not used anymore. You don't need to setup anything on Linux.


Thank you for the contribution from rob

Since NPOI uses System.Drawing.Common, you must install libgdiplus and libc6 on Linux system.

Ubuntu 16.04+

apt-get install libgdiplus libc6-dev
cd /usr/lib
ln -s libgdiplus.so gdiplus.dll

Fedora 23+

dnf install libgdiplus
cd /usr/lib64/
ln -s libgdiplus.so.0 gdiplus.dll

CentOS 7+

yum install autoconf automake libtool
yum install freetype-devel fontconfig libXft-devel
yum install libjpeg-turbo-devel libpng-devel giflib-devel libtiff-devel libexif-devel
yum install glib2-devel cairo-devel
git clone https://github.com/mono/libgdiplus
cd libgdiplus
./autogen.sh
make
make install
cd /usr/lib64/
ln -s /usr/local/lib/libgdiplus.so gdiplus.dll

Docker image - Alpine

base sdk-alpine/aspnetcore-runtime-alpine images

RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk --update add libgdiplus

Docker image - Debian

FROM microsoft/dotnet:2.1-aspnetcore-runtime
RUN apt-get update && apt-get install -y libgdiplus libc6-dev && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll

Analytics