Skip to Content
NexPDF

Installation

Add the NexPDF MAUI package, provide the native engine for each platform and declare the XAML namespace.

English

Install the MAUI workload

dotnet workload install maui

The package targets net10.0-android, net10.0-ios, net10.0-maccatalyst and, when built on Windows, net10.0-windows10.0.19041.0.

Add the package

dotnet add package Nexdevit.NexPdf.Maui --version 1.1.0

Do not also reference Nexdevit.NexPdf: the MAUI package already contains NexPdfDocument and NexPdfSdk (namespace Nexdevit.NexPdf).

Provide the native engine

Each platform needs its engine binary. The v1.1.0 release carries them:

PlatformRelease assetEngine
iOS, Mac CatalystNexPdfCore.xcframework.zipNexPdfCore.xcframework, linked statically (the engine is called through __Internal)
Androidnexpdf-android-1.1.0.aarlibnexpdf_ffi.so per ABI, under jni/<abi>/ inside the AAR (a zip archive)
Windowsnexpdf-ffi-1.1.0-windows-x64.ziplib/nexpdf_ffi.dll

When you build NexPdf.Maui from its repository (the "From source" tab above), unpack the assets into native/ next to the project, as they unpack (since 1.0.1), or pass -p:NexPdfNativeDir=<folder> with the same layout:

PlatformUnpack to
iOS, Mac Catalystnative/NexPdfCore.xcframework
Androidnative/android/jni/<abi>/libnexpdf_ffi.so (the jni/ folder of the AAR)
Windowsnative/windows/nexpdf_ffi.dll

The iOS, Mac Catalyst and Android builds stop with a message naming the missing folder when the engine for the target is not there. Inside the NexPDF source tree, when native/ has none, the project picks the engine up from these places:

PlatformWhat to buildPicked up from
iOS, Mac Catalystscripts/build-ios-xcframework.shsdks/swift/NexPdfCore.xcframework
Androidthe Android SDK buildsdks/android/src/main/jniLibs/<abi>/libnexpdf_ffi.so
Windowscargo build --release -p nexpdf-ffitarget/release/nexpdf_ffi.dll

In your own app you can reference the binaries from the release directly:

MyApp.csproj
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'ios' Or '$(TargetPlatformIdentifier)' == 'maccatalyst'">
  <NativeReference Include="native/NexPdfCore.xcframework">
    <Kind>Static</Kind>
    <ForceLoad>true</ForceLoad>
    <Frameworks>Security</Frameworks>
  </NativeReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'android'">
  <AndroidNativeLibrary Include="native/android/**/libnexpdf_ffi.so" />
</ItemGroup>
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
  <None Include="native/windows/nexpdf_ffi.dll" Link="nexpdf_ffi.dll" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

Keep the ABI folder names (arm64-v8a, x86_64, ...) under native/android/.

Declare the XAML namespace

The assembly is NexPdf.Maui and the namespace Nexdevit.NexPdf.Maui:

MainPage.xaml
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:nex="clr-namespace:Nexdevit.NexPdf.Maui;assembly=NexPdf.Maui"
             x:Class="MyApp.MainPage">
  <nex:PdfView x:Name="Viewer" DocumentBytes="{Binding Pdf}" />
</ContentPage>

Build

dotnet build -f net10.0-android

On this page