Installation
Das NexPDF-NuGet-Paket zu einem .NET-Projekt hinzufügen und die native Engine-Bibliothek bereitstellen.
Paket hinzufügen
dotnet add package Nexdevit.NexPdf --version 1.1.0Der Namespace ist Nexdevit.NexPdf.
Native Bibliothek beschaffen
Laden Sie das Archiv für Ihre Plattform aus dem Release v1.1.0 herunter:
| Plattform | Archiv | Bibliothek |
|---|---|---|
| Linux x64 | nexpdf-ffi-1.1.0-linux-x64.tar.gz | lib/libnexpdf_ffi.so |
| Linux arm64 | nexpdf-ffi-1.1.0-linux-arm64.tar.gz | lib/libnexpdf_ffi.so |
| macOS | nexpdf-ffi-1.1.0-macos-universal.tar.gz | lib/libnexpdf_ffi.dylib |
| Windows x64 | nexpdf-ffi-1.1.0-windows-x64.zip | lib/nexpdf_ffi.dll |
Bibliothek dort ablegen, wo .NET sie findet
Zur Laufzeit lädt .NET nexpdf_ffi aus dem Anwendungsordner oder dem Systembibliothekspfad
(LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PATH). Am einfachsten kopieren Sie sie in den
Ausgabeordner:
<ItemGroup>
<None Include="native/libnexpdf_ffi.so" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>Installation prüfen
Console.WriteLine(Nexdevit.NexPdf.NexPdfSdk.Version);Ein Paket, das die Engine enthält
NuGet kopiert die passende native Bibliothek neben die Anwendung, wenn das Paket pro Runtime
Identifier eine unter runtimes/<rid>/native/ enthält. Um ein solches Paket aus dem SDK-Quellcode zu
bauen, legen Sie die Bibliotheken dort ab und packen:
dotnet pack nexpdf-dotnet/NexPdf.csproj -c ReleaseDie macOS-Release-Bibliothek ist universal, daher kommt dieselbe Datei in beide osx--Ordner.
Docker
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"]