Pysar.Uno 0.1.63

dotnet add package Pysar.Uno --version 0.1.63
                    
NuGet\Install-Package Pysar.Uno -Version 0.1.63
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pysar.Uno" Version="0.1.63" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pysar.Uno" Version="0.1.63" />
                    
Directory.Packages.props
<PackageReference Include="Pysar.Uno" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pysar.Uno --version 0.1.63
                    
#r "nuget: Pysar.Uno, 0.1.63"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pysar.Uno@0.1.63
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pysar.Uno&version=0.1.63
                    
Install as a Cake Addin
#tool nuget:?package=Pysar.Uno&version=0.1.63
                    
Install as a Cake Tool

Pysar.Uno

Uno Platform integration for Pysar, a cross-platform report engine for .NET: packaged asset access, font registration, a scrollable, zoomable ReportView and PDF printing and sharing. It installs a UnoReportPlatformHandler for file and font access.

One net10.0 target covers every Uno Skia host — Desktop, WebAssembly, Android and iOS. The Windows App SDK head is not supported yet.

dotnet add package Pysar.Uno

Built against Uno Platform 6.7. Your application keeps whatever SkiaSharp its Uno host asks for; the one Pysar renders through is resolved alongside it, which is the arrangement the Avalonia package has always used.

Packaging report assets

Keep fonts, images and styles in Assets/ — Uno's package root:

Assets/Fonts/Ubuntu-Regular.ttf
Assets/Images/logo.svg
Assets/Styles/report.rxaml

Declare them with ReportAsset and a Link back to the path the report asks for (Fonts/...), the same contract Maui, WPF and Avalonia use — do not put Assets/ in that path. Pysar packages them as EmbeddedResource:

<ItemGroup>
  <ReportAsset Include="Assets\Fonts\**" Link="Fonts\%(Filename)%(Extension)" />
  <ReportAsset Include="Assets\Images\**" Link="Images\%(Filename)%(Extension)" />
  <ReportAsset Include="Assets\Styles\**" Link="Styles\%(Filename)%(Extension)" />
</ItemGroup>

Embedded resources rather than the ms-appx:/// URIs an Uno application usually reaches for, because asset reads here have to be synchronous. SkiaFontCollection.AddFont, a ResourceDictionary Source in .rxaml and the image renderer all read without awaiting; StorageFile is asynchronous, and on the WebAssembly host blocking on it is a deadlock on the single thread rather than a stall. A manifest resource is readable synchronously on every host.

An application that already ships those files as Content can fetch them once at startup instead. Pass the report path; it is read from ms-appx:///Assets/...:

await this.UsePysarAsync(
    typeof(App).Assembly,
    ["Fonts/Ubuntu-Regular.ttf", "Images/logo.svg"],
    pysar => pysar.AddFont("Fonts/Ubuntu-Regular.ttf", "Ubuntu"));

Every read after that is a dictionary lookup, so the synchronous callers are satisfied.

Setup

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    this.UsePysar(typeof(App).Assembly, pysar => pysar
        .AddFont("Fonts/Ubuntu-Regular.ttf", "Ubuntu")
        .AddFont("Fonts/Ubuntu-Bold.ttf", "Ubuntu", FontStyle.Bold));

    // ... the rest of your launch
}

An extension on Application rather than on a host builder: an Uno application has no service collection of its own unless it also uses Uno.Extensions, and UnoPlatformHostBuilder exists only in the WebAssembly and Desktop heads — Android, iOS and WinAppSDK start through Application.Start. OnLaunched is the one place every head runs. PysarUno.PlatformHandler, PysarUno.Renderer and PysarUno.ExportService reach what registration installed.

On a browser head this also stops the page zooming when Ctrl (or Command) plus wheel — or the trackpad pinch the browser delivers as the same event — is meant for the report. The suppression covers the Uno canvas and is permanent once installed: Uno draws the whole application into one canvas, so the listener cannot tell the report from the toolbar beside it, while a host page's own markup around the application keeps the browser's zoom. Pass suppressBrowserZoom: false to leave it alone.

Showing a report

xmlns:pysar="using:Pysar.Uno"

<pysar:ReportView Report="{Binding Report}"
                  ZoomMode="FitWidth"
                  Zoom="{Binding Zoom, Mode=TwoWay}"
                  EffectiveZoom="{Binding EffectiveZoom, Mode=OneWayToSource}"
                  CurrentPage="{Binding CurrentPage, Mode=TwoWay}"
                  PageSpacing="24" />

The report must already have Build() called.

Property
Report The built report to show
ZoomMode FitWidth, FitPage or Custom
Zoom The factor used when ZoomMode is Custom; 1 is 100%. Bind Mode=TwoWay so a gesture writes back — WinUI defaults to OneWay
EffectiveZoom What the current mode actually resolved to — bind Mode=OneWayToSource to display a percentage, since Zoom holds what was asked for
CurrentPage The page at the top of the viewport, one-based; bind Mode=TwoWay
PageCount Pages in the built report
PageSpacing The gap between two pages
PageBorderColor, PageBorderThickness The line framing each page; thickness 0 leaves it unframed
DocumentPadding The space between the viewport edges and the document
VerticalOverdraw How far past the viewport to keep tiles sharp, as a fraction of its height
RenderBudget Megabytes the visible pages may occupy before pages stop being drawn whole
RenderFailed Raised when a report could not be prepared or a page could not be drawn

Ctrl or the platform command key with the wheel zooms around the pointer; a plain wheel scrolls. A trackpad or touch pinch zooms, and a double tap magnifies and returns.

Only the visible region is rasterised, so memory follows the size of the viewport rather than the zoom level. The arithmetic behind that — page geometry, zoom, tile planning — lives in Pysar.Viewer and is shared with every other platform package.

Printing

var printer = new UnoReportPrinter(PysarUno.Renderer);
await printer.PrintAsync(builtReport);

Desktop only. macOS shows the system Print panel through PDFKit, Windows uses the shell print verb, and Linux opens the PDF in the default viewer to print from there.

Android, iOS and WebAssembly throw PlatformNotSupportedException: each of their print paths belongs to an activity, a view controller or the browser, and none is reachable from a class library without that platform's own target framework — which this package deliberately does not have. Produce the bytes yourself on those hosts and share or download them:

var pdf = await PysarUno.ExportService.ExportAsync(builtReport, ExportFormat.Pdf);
await PysarUno.Sharer.ShareAsync(pdf, "report.pdf");

UnoReportSharer writes the bytes to a temp file and asks the host to open them — a download in the browser, a share/open sheet on Android and iOS, and the default application on desktop.

Documentation

License

MIT — see LICENSE.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.63 63 10/1/2026
0.1.56 93 9/20/2026
0.1.53 96 9/20/2026
0.1.46 107 9/18/2026
0.1.44 97 9/16/2026
0.1.41 89 9/15/2026
0.1.38 90 9/14/2026

## Avalonia fonts

**Report fonts can come from Avalonia `FontManager`.**
`UsePysar` installs a typeface fallback before your configuration. The family string in the report must be the Avalonia `FontFamily` string — `fonts:Inter#Inter` after `WithInterFont`, or `avares://MyApp/Fonts#Ubuntu` for a resource folder — not a file path. A bare name is a system-font lookup; if `TryGetGlyphTypeface` substitutes Helvetica, Pysar treats that as a miss.

`AddFont` still wins. A library `ReportAsset` still needs one `AddFont`: the file is not copied into the head, and `FontManager` does not see it. A XAML `FontFamily` resource is not a registration. Styles stay `Normal`, `Bold`, `Italic` and `BoldItalic`. This bridge is Avalonia only. Console, the design-time preview, MAUI, WPF and Uno keep `AddFont`.

## PDF export

**PDF/A-2b is an option of PDF, not another format.**
Pass `new PdfExportOptions { PdfA = true }` to `SavePdfAsync`, `RenderToPdfAsync`, `RenderToPdfBytesAsync`, or `IReportExportService.ExportAsync`. Skia writes the archival document setup: XMP `pdfaid` identification, a document UUID, and an sRGB output intent. It does not validate the file. A font Skia cannot embed still fails a checker, and the UUID makes those bytes non-reproducible. Existing overloads are unchanged.

## Images

**SVG is drawn from the bytes, not only from a `.svg` path.**
A stream or embedded source whose bytes start with `<svg` (optional XML declaration) is rendered as SVG. A decode or parse failure is recorded on the image cache, so the same bad bytes are not decoded again. Fixes #23.

## Rendering

**A built report may be rendered more than once, only sequentially.**
PDF and then page bitmaps, or a retry of the same export, is supported. Do not render one instance concurrently. `PageNumber` and `PageCount` are scratch written during the pass, and `OnPageChanged` runs again on every render.

## Uno

**Android report pages no longer depend on OpenGL ES.**
`UsePysar` sets `UseOpenGLOnSkiaAndroid` to false before the window is created. OpenGL ES draws image textures as opaque black, which hid every report page.

## Internal

- Host startup (Avalonia, MAUI, WPF, Uno) shares one installation sequence, `PysarInstallation`.
- `InternalsVisibleTo` for `Pysar.Avalonia` and `Pysar.Avalonia.Tests`.

**Full changelog:** v0.1.56...HEAD