How sungaila/pdftoimage works
Project type and purpose
• PDFtoImage is a cross-platform .NET library that renders PDF pages to images, built on native PDFium + SkiaSharp.
• It ships as a NuGet package and as a Unity package, and includes sample apps (FrameworkTests) and a Blazor WebConverter demo.
Decompose the file structure into high-level modules
• “Core Library” (src/PDFtoImage): public API, conversion entry points, options, code-signing and packaging targets.
• “Internals” (src/PDFtoImage/Internals): LibraryLoader, NativeMethods, PdfDocument/File/Library abstractions.
• “Platform-native binaries” (etc/UnityPackage/Plugins): PDFium & SkiaSharp .dll/.so/.dylib per platform.
• “PublicAPI” folder: shipped/unshipped surface for net462, net6.0, netstandard2.1, iOS, Android, etc.
• “Consumers & Samples”
• FrameworkTests (console, ASP.NET, ASP.NET Core, MAUI, Unity2D)
• WebConverter (Blazor-WASM client)
• “Tests” (src/Tests): unit + integration assets for Windows, Linux, macOS.
• CI/CD & Packaging (/.github/workflows, Dockerfiles in AotConsole, PDFtoImage.*.targets).
Sketch the layered architecture
[Presentation / Consumer Layer]
– FrameworkTests apps (AotConsole, ASP.NET, ASP.NET Core, MAUI, Unity2D)
– Blazor WebConverter UI
[Application / API Layer]
– PDFtoImage.Conversion static methods
– RenderOptions, PdfRotation, AntiAliasing, IRenderOptions
[Core Library Layer]
– Conversion.*.cs (SavePng, SaveJpeg, ToImage(s))
– Exception types
[Internal Abstraction Layer]
– LibraryLoader (decides which native lib to load)
– NativeMethods pinvoke bindings
– PdfLibrary / PdfDocument / StreamManager
[Native Engine Layer]
– PDFium (native renderer)
– SkiaSharp (drawing engine)
[Packaging & Delivery]
– NuGet packaging (.props/.targets, public API manifests)
– UnityPackage (etc/UnityPackage)
– Dockerfiles for AOT publish
[Test Harness]
– Unit tests (src/Tests)
– Platform-specific expected images and test PDFs
Relationships & data flows
• In sample apps, illustrate that each framework (MAUI, Unity, ASP.NET) references the same Conversion API.
• LibraryLoader selecting platform .dll via metadata from etc/UnityPackage/Plugins or native folder at runtime.
Architectural patterns & design principles
• Layered architecture (Presentation → API → Core → Internals → Native)
• Abstraction via interfaces (IRenderOptions) and P/Invoke wrappers.
• Multi-targeting/public API manifests to support many frameworks.
• Plugin-style native library loading.
Technologies & frameworks
– .NET 6/7/8, .NET Framework 4.6.2+
– PDFium (native)
– SkiaSharp (native)
– CI/CD: GitHub Actions (dotnet.yml), SonarCloud quality gate
– Container builds: Dockerfiles for AOT console
– Consumers: ASP.NET, ASP.NET Core, Blazor WASM, .NET MAUI, Unity, UWP, WinUI 3