How-to guides/Errors & Debugging
DllNotFoundException
Unable to load DLL 'IronPdf.Native.Linux'

How to fix IronPDF DllNotFoundException: unable to load 'IronPdf.Native.Linux'

IronPDF ships a native binary for each platform. When that binary is missing, the wrong architecture is deployed, or required system libraries are absent, .NET throws DllNotFoundException. This guide covers dependency installation, Docker configuration, and a DLL-free alternative.

Why this happens

Missing native DLL in deployment artifact

IronPDF's NuGet package includes platform-specific native binaries. If your publish step excludes native assets (e.g. using --no-self-contained without the right runtime identifier), the IronPdf.Native.Linux.so file is absent at runtime and .NET cannot load it.

Wrong CPU architecture

IronPDF ships separate binaries for x64 and ARM64. Deploying an x64 build to an ARM-based server (e.g. AWS Graviton, Apple Silicon Docker host) or vice versa causes the DllNotFoundException because the binary exists but is for the wrong architecture.

Missing libgdiplus or other system dependencies on Linux

IronPDF's Linux native layer depends on libgdiplus, libfontconfig, and other system libraries that are not present in minimal base images like alpine or debian-slim. Without these, the native library itself fails to load even if the file is present.

How to fix it

1

Install required system dependencies on Linux

Before running your application, install the native dependencies that IronPDF's Linux binary requires. Add these to your Dockerfile or server provisioning script.

# Debian/Ubuntu base image
RUN apt-get update && apt-get install -y \
    libgdiplus \
    libfontconfig1 \
    libc6 \
    libssl3 \
    && rm -rf /var/lib/apt/lists/*
2

Publish with the correct runtime identifier

Ensure your dotnet publish command targets the correct runtime. If you are deploying to Linux x64, use linux-x64. For ARM64 use linux-arm64. This ensures the matching native binary is included in the output.

# Publish targeting Linux x64 explicitly
dotnet publish -c Release -r linux-x64 --self-contained true

# Or for ARM64 (AWS Graviton, Apple Silicon):
dotnet publish -c Release -r linux-arm64 --self-contained true
3

Migrate to PDFluent — no native DLLs required

PDFluent is a pure Rust library distributed as a single static binary. There are no platform-specific DLLs, no libgdiplus dependency, and no architecture mismatches. It runs on Linux, macOS, and Windows x64/ARM64 from a single build.

use pdfluent::PdfDocument;

// No DLL loading, no native dependencies to install
let doc = PdfDocument::open("input.pdf")?;
let text = doc.page(1)?.text()?;
println!("{}", text);

Frequently asked questions