Skip to Content
NexPDF

Installation

Add the NexPDF NuGet package to a .NET project and make the native engine library available.

English

Add the package

dotnet add package Nexdevit.NexPdf --version 1.1.0

The namespace is Nexdevit.NexPdf.

Get the native library

Download the archive for your platform from the v1.1.0 release:

PlatformArchiveLibrary
Linux x64nexpdf-ffi-1.1.0-linux-x64.tar.gzlib/libnexpdf_ffi.so
Linux arm64nexpdf-ffi-1.1.0-linux-arm64.tar.gzlib/libnexpdf_ffi.so
macOSnexpdf-ffi-1.1.0-macos-universal.tar.gzlib/libnexpdf_ffi.dylib
Windows x64nexpdf-ffi-1.1.0-windows-x64.ziplib/nexpdf_ffi.dll

Put the library where .NET finds it

At run time .NET loads nexpdf_ffi from the application folder or the system library path (LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PATH). The simplest way is to copy it to the output folder:

MyApp.csproj
<ItemGroup>
  <None Include="native/libnexpdf_ffi.so" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

Check the installation

Console.WriteLine(Nexdevit.NexPdf.NexPdfSdk.Version);

A package that carries the engine

NuGet copies the right native library next to the application when the package holds one per runtime identifier under runtimes/<rid>/native/. To build such a package from the SDK source, put the libraries there and pack:

NexPdf.csproj
dotnet pack nexpdf-dotnet/NexPdf.csproj -c Release

The macOS release library is universal, so the same file goes in both osx- folders.

Docker

Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0
ADD https://github.com/nexdevit/nexpdf-dotnet/releases/download/v1.1.0/nexpdf-ffi-1.1.0-linux-x64.tar.gz /tmp/
RUN tar -xzf /tmp/nexpdf-ffi-1.1.0-linux-x64.tar.gz -C /opt
ENV LD_LIBRARY_PATH=/opt/nexpdf-ffi-1.1.0-linux-x64/lib
COPY publish/ /app/
WORKDIR /app
ENTRYPOINT ["dotnet", "MyApp.dll"]

On this page