PrintingTools.Windows
0.1.0-alpha.1
dotnet add package PrintingTools.Windows --version 0.1.0-alpha.1
NuGet\Install-Package PrintingTools.Windows -Version 0.1.0-alpha.1
<PackageReference Include="PrintingTools.Windows" Version="0.1.0-alpha.1" />
<PackageVersion Include="PrintingTools.Windows" Version="0.1.0-alpha.1" />
<PackageReference Include="PrintingTools.Windows" />
paket add PrintingTools.Windows --version 0.1.0-alpha.1
#r "nuget: PrintingTools.Windows, 0.1.0-alpha.1"
#:package PrintingTools.Windows@0.1.0-alpha.1
#addin nuget:?package=PrintingTools.Windows&version=0.1.0-alpha.1&prerelease
#tool nuget:?package=PrintingTools.Windows&version=0.1.0-alpha.1&prerelease
PrintingTools
Cross-platform .NET 10 printing toolkit for applications that need consistent print dialogs, previews, pagination, and job submission across Windows, macOS, and Linux.
NuGet Packages
Primary Packages
Key Features
- Unified
IPrintManagerAPI for printer discovery, session creation, preview generation, and print submission. - Platform adapters for Win32/XPS, macOS AppKit, and Linux CUPS/GTK with managed fallbacks for headless and CI runs.
- Built-in pagination, layout modes (
standard,N-up,booklet,poster), vector/PDF export via Skia, and diagnostics hooks. - Optional Avalonia UI components for page setup, preview windows, and macOS native preview hosting.
- Cross-platform harnesses and samples that validate output, metrics, and environment-specific behavior in CI.
Package Selection
| Scenario | Recommended package set |
|---|---|
| Avalonia app that wants automatic platform registration | PrintingTools |
| Avalonia app that also wants ready-made dialogs and preview windows | PrintingTools + PrintingTools.UI |
| Custom UI or headless workflow with direct control over the pipeline | PrintingTools.Core + one or more platform packages |
| Platform-specific integration or diagnostics work | PrintingTools.Windows, PrintingTools.MacOS, or PrintingTools.Linux directly |
Architecture Overview
| Package | Purpose |
|---|---|
src/PrintingTools.Core |
Cross-platform contracts (IPrintManager, PrintServiceRegistry), pagination/rendering pipeline, diagnostics, and option models. |
src/PrintingTools.Windows |
Win32 adapter for queue discovery, XPS/PDF export, native dialog orchestration, and job monitoring. |
src/PrintingTools.MacOS |
AppKit bridge with preview hosting (MacPreviewHost), sandbox-aware ticket handling, and Quartz PDF output. |
src/PrintingTools.Linux |
CUPS/IPP adapter that shells through lp/lpoptions, detects GTK dialogs, and supports Flatpak/Snap portals. |
src/PrintingTools.UI |
Avalonia page setup dialog, preview window, and supporting view models. |
src/PrintingTools |
AppBuilder.UsePrintingTools extension that wires the right adapter at runtime and exposes helper accessors. |
The adapters register through PrintingToolsOptions.AdapterFactory. Configure PrintServiceRegistry once during startup, or call AppBuilder.UsePrintingTools(...) in Avalonia, and then resolve the active IPrintManager through PrintServiceRegistry.EnsureManager().
Repository Layout
| Path | Description |
|---|---|
src/ |
Library implementation projects described above. |
samples/ |
Avalonia desktop sample and platform harnesses for Windows, macOS, and Linux. |
tests/PrintingTools.Tests |
Unit tests and harness metric threshold validation. |
docs/ |
Design notes, platform guides, migration help, release-readiness notes, and feature parity tracking. |
exten/ |
Vendored prerequisites used by the samples and research branches. |
Getting Started
Prerequisites
- .NET SDK 10.0.100-rc.2 with prerelease support enabled.
- Windows: Win32 spooler available and XPS support enabled.
- macOS: macOS 14+ with Xcode command line tools for building the native preview bridge.
- Linux: CUPS 2.3+,
cups-client(lp,lpoptions), and GTK 3/4 libraries for native dialog integration.
Install Packages
For a typical Avalonia app:
dotnet add package PrintingTools
dotnet add package PrintingTools.UI
For direct pipeline usage without the packaged UI:
dotnet add package PrintingTools.Core
dotnet add package PrintingTools.Windows
Swap the platform package as needed for macOS or Linux.
Restore and Build
git clone https://github.com/wieslawsoltes/PrintingTools.git
cd PrintingTools
dotnet restore PrintingTool.sln
dotnet build PrintingTool.sln -c Release
Configure Printing in Your App
using PrintingTools.Core;
var options = new PrintingToolsOptions
{
DiagnosticSink = evt => Console.WriteLine($"[{evt.Category}] {evt.Message}")
};
PrintServiceRegistry.Configure(options);
var manager = PrintServiceRegistry.EnsureManager();
Avalonia Applications
using Avalonia;
using PrintingTools;
using PrintingTools.Core;
AppBuilder.Configure<App>()
.UsePlatformDetect()
.UsePrintingTools(options =>
{
options.EnablePreview = true;
options.DefaultTicket = PrintTicketModel.CreateDefault();
})
.StartWithClassicDesktopLifetime(args);
Request a Preview or Print Session
var document = PrintDocument.FromVisual(myVisual);
var request = new PrintRequest(document)
{
Options = new PrintOptions { ShowPrintDialog = true },
Ticket = PrintTicketModel.CreateDefault(),
Description = "Quarterly report"
};
var session = await manager.RequestSessionAsync(request);
var preview = await manager.CreatePreviewAsync(session);
await manager.PrintAsync(session);
CreatePreviewAsync(...) returns a PrintPreviewModel that you can render in PrintingTools.UI.Controls.PrintPreviewWindow or a platform-specific preview host.
Samples and Harnesses
| Sample | Command | Highlights |
|---|---|---|
samples/AvaloniaSample |
dotnet run --project samples/AvaloniaSample/AvaloniaSample.csproj |
Desktop UI demonstrating preview, native dialogs, page setup, and job history. |
samples/WindowsPrintHarness |
dotnet run -c Release --project samples/WindowsPrintHarness/WindowsPrintHarness.csproj -- --output=artifacts/windows/output.pdf --metrics=artifacts/windows/metrics.json --stress=3 |
Headless smoke tests for the Win32 adapter, managed PDF export, and metrics capture. |
samples/MacSandboxHarness |
dotnet run -c Release --project samples/MacSandboxHarness/MacSandboxHarness.csproj -- --headless --output=artifacts/macos/output.pdf --metrics=artifacts/macos/metrics.json --stress=3 |
Validates AppKit bridge behavior, Quartz PDF output, and sandbox-aware diagnostics. |
samples/LinuxSandboxHarness |
GTK_USE_PORTAL=1 GIO_USE_PORTALS=1 dotnet run -c Release --project samples/LinuxSandboxHarness/LinuxSandboxHarness.csproj -- --print --output=artifacts/linux/output.pdf --metrics=artifacts/linux/metrics.json --stress=3 |
Exercises the CUPS adapter, portal-aware dialogs, and managed PDF generation for CI. |
Documentation
- Documentation site: wieslawsoltes.github.io/PrintingTools
- API reference: docs/printing-api-reference.md
- Migration guide: docs/printing-migration-guide.md
- Platform notes: Windows, macOS, Linux
- Platform support matrix: docs/platform-support-matrix.md
- Sample walkthroughs: docs/printing-sample-walkthroughs.md
- Architecture and planning notes: phase2-architecture, feature-parity-matrix, wpf-printing-parity-plan
Build docs locally:
./build-docs.sh
./serve-docs.sh
PowerShell equivalents are available as build-docs.ps1, check-docs.ps1, and serve-docs.ps1.
Release and CI
ci.ymlruns cross-platform restore/build/test, executes the Windows/macOS/Linux harnesses, and validates that all NuGet packages can be packed.docs.ymlbuilds the Lunet site and publishes it to GitHub Pages on pushes to the primary branch.release.ymlruns on tags likev0.2.0, packs all six publishable libraries, verifies the macOS native bridge is present in the package, publishes to NuGet, and creates a GitHub release.- Configure
NUGET_API_KEYin repository secrets before using the release workflow for publishing.
License
Distributed under the terms of the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Avalonia.Skia (>= 11.3.6)
- PrintingTools.Core (>= 0.1.0-alpha.1)
- SkiaSharp (>= 3.119.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PrintingTools.Windows:
| Package | Downloads |
|---|---|
|
PrintingTools
Avalonia integration helpers and platform adapter bootstrapper for PrintingTools, wiring Windows, macOS, and Linux implementations. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-alpha.1 | 64 | 3/10/2026 |