NETReporter.Client 3.5.0

NETReporter.Client

Tenký klient pro ReportServer: stejné rozhraní jako knihovna NETReporter, ale report se vykreslí na serveru. Aplikace nemusí nést QuestPDF, Roslyn, OxyPlot ani ZXing; přihlašuje se API tokenem, který si vygenerujete v UI ReportServeru.

Klient implementuje IReportRenderer a ITemplateTools z balíčku NETReporter.Abstractions, takže mezi lokálním a vzdáleným renderem přepíná jen registrace v DI. Kód, který renderuje, se nemění.

Instalace

dotnet nuget add source https://nuget.advisor-soft.com/v3/index.json --name AdvisorSoft
dotnet add package NETReporter.Client

Požadavky: .NET 10. Balíčky NETReporter, NETReporter.Abstractions a NETReporter.Client se vydávají společně se stejnou verzí.

API token

  1. Přihlaste se do UI ReportServeru a otevřete stránku API tokeny.
  2. Zadejte název (a případně dobu platnosti) a token vytvořte. Otevřený text se ukáže jen jednou, server si pamatuje jen hash; uložte ho do tajných hodnot (proměnná prostředí, user secrets, trezor), ne do repozitáře.
  3. Token má stejná práva jako jeho vlastník. Odvolat ho může vlastník i správce; deaktivace vlastníka ho vyřadí hned.

Rychlý start s DI

using Microsoft.Extensions.DependencyInjection;
using NetReporter;

services.AddNetReporterClient(options =>
{
    options.BaseAddress = new Uri("https://reports.example.com/api");   // adresa API včetně předpony cesty
    options.ApiToken = configuration["NetReporter:ApiToken"];           // nrp_…
});

// kdekoli v aplikaci
public sealed class InvoiceService(IReportRenderer renderer)
{
    public async Task<byte[]> CreatePdfAsync(Stream template, Stream data)
    {
        await using var pdf = await renderer.RenderAsync(template, data);
        using var buffer = new MemoryStream();
        await pdf.CopyToAsync(buffer);
        return buffer.ToArray();
    }
}

Nastavení jde číst z konfigurace: services.AddNetReporterClient(configuration) čte sekci NetReporterClient s klíči BaseAddress, ApiToken a Timeout. Chybějící adresa nebo token zastaví aplikaci při startu srozumitelnou chybou.

Bez DI

using NetReporter.Client;

using var http = NetReporterClient.CreateHttpClient(new NetReporterClientOptions
{
    BaseAddress = new Uri("https://reports.example.com/api"),
    ApiToken = Environment.GetEnvironmentVariable("NETREPORTER_API_TOKEN")
});

IReportRenderer renderer = new ReportServerRenderer(http);
ITemplateTools tools = new ReportServerTemplateTools(http);

Co klient umí

  • Render libovolné šablony (ad-hoc) do všech formátů: PDF, HTML, JSON, SVG, WebP, PNG, JPEG, i po stránkách (RenderSvgPagesAsync, RenderWebpPagesAsync, …) a se všemi volbami RenderOptions (PDF/A, přílohy, šifrování, vodoznak, rozlišení…).
  • Diagnostiky bindingů přes RenderOptions.OnBindingDiagnostics a pozorovatele pipeline.
  • Nástroje nad šablonou (ITemplateTools): validace šablony a dat, datový kontrakt a ukázková data.
  • Mimo rozsah: správa uložených šablon, render podle uložené šablony a historie jobů (ty zůstávají v UI a REST API).

Čím se vzdálený render liší od lokálního

  • Soubory z disku se na serveru nenačítají: obrázky, SVG ani podklady PDF z cesty k souboru nefungují (použijte data URI nebo adresu http/https).
  • Server omezuje počet stránek, rozlišení obrazů a velikost příloh; diagnostik bindingů vrací nejvýše 50 různých.
  • RenderOptions.Icons se nepoužije: server vykresluje ikony vlastním katalogem.
  • Pozorovatel pipeline dostane zjednodušené události (parsování proběhlo na serveru).

Chyby

Situace Výjimka
Chyba v šabloně ReportServerException (kód TEMPLATE_VALIDATION_FAILED, Diagnostics s JSON cestami)
Vadné volby ArgumentException (ParamName == "options"), u lokálních kontrol bez volání serveru
Překročený limit stránek RenderPageLimitExceededException
Zrušení volajícím OperationCanceledException
Neplatný, odvolaný nebo prošlý token ReportServerException (AUTH_UNAUTHORIZED)
Server nedostupný nebo překročený Timeout ReportServerException (REPORTSERVER_UNAVAILABLE nebo REPORTSERVER_TIMEOUT)

ReportServerException dědí z InvalidOperationException, takže ji zachytí i kód napsaný pro lokální render. Seznam změn je v souboru CHANGELOG.md v balíčku.

No packages depend on NETReporter.Client.

- Dependencies (security): `System.Security.Cryptography.Pkcs` 10.0.0, which `MimeKit` 4.18.1 (through `MailKit` in `NetReporter.Identity`) pulls in, has two known denial-of-service advisories (GHSA-846f-f764-76mx, GHSA-2fmv-rv2c-59x7; fixed in 10.0.13), and `System.Security.Cryptography.Xml` 10.0.12 (through ASP.NET Core Data Protection, seen in `tools/assistant-eval`) has three (GHSA-r955-8q5j-3h83, GHSA-7hqp-7c5m-4vq6, GHSA-c399-9853-6jmj; fixed in 10.0.13). `NetReporter.Identity` now references `Pkcs` 10.0.13 directly, which lifts it in the ReportServer API and UI, the template editor and the tests, and the ASP.NET Core and EF Core packages moved from 10.0.12 to 10.0.13 (this also fixes `Xml`). The published NuGet packages `NETReporter`, `NETReporter.Abstractions` and `NETReporter.Client` never depended on these two packages; the vulnerable copy was in the server images (`api`, `ui`, `editor`). - **Behavior change** (dependencies): all NuGet packages were raised to the latest version, so the published packages have higher dependency floors. `NETReporter` needs `Microsoft.CodeAnalysis.CSharp.Scripting` 5.9.0 (was 4.14.0; the C# expressions of the bindings), `Microsoft.Extensions.DependencyInjection.Abstractions` and `Microsoft.Extensions.Logging.Abstractions` 10.0.13 (were 8.0.0), `Microsoft.Extensions.Configuration.UserSecrets` 10.0.13 (was 6.0.1) and `ZXing.Net` 0.16.11; `NETReporter.Client` needs `Microsoft.Extensions.Http` and `Microsoft.Extensions.Options.ConfigurationExtensions` 10.0.13 (were 8.0.x). A consumer that pins Roslyn 4.x or an older `Microsoft.Extensions.*` must raise it (the packages target .NET 10, whose own `Microsoft.Extensions.*` are 10.0.x). - Dependencies (server and editor): Syncfusion Blazor 32.1.19 to **34.2.9** (the umbrella package `Syncfusion.Blazor` ends at 33.2.15, so the editor references the components it uses: `Core`, `Buttons`, `DropDowns`, `Inputs`, `Navigations`, `Popups`, `Ribbon`, `SplitButtons` and `Themes`, all on one version), Serilog 8 to 10 (`Serilog.AspNetCore` 10.0.0, `Settings.Configuration` 10.0.1, sinks `Console` 6.1.1 and `File` 7.0.0, enrichers `Environment` 3.0.1, `Process` 3.0.0, `Thread` 4.0.0), `FluentStorage` and `FluentStorage.AWS` 6.0.2 to 8.0.22 and 8.0.23 (the storage code moved to the new `IStore` API: `SetObject`, `OpenRead`, `ObjectExists`, `DeleteObject`, `ListObjects`, `AwsS3Storage.FromCredentials` and `FromThirdPartyCredentials`; behavior is unchanged, verified against the disk storage and an S3-compatible server), `AWSSDK.Core` 4.0.102.11, `Anthropic` 12.57.0, `Microsoft.Extensions.AI` 10.11.0, `MinVer` 8.0.0 and `dotnet-ef` 10.0.13. `Microsoft.EntityFrameworkCore.Design` is 10.0.13 now, and the ReportServer API pins `Microsoft.CodeAnalysis.CSharp.Workspaces` and `Workspaces.MSBuild` to 5.9.0 so it matches the Roslyn of the expression scripting (the Design package asks for exactly 5.0.0, NU1107). The test packages moved to `xunit` 2.9.3 (the last 2.x; the package is marked legacy in favor of `xunit.v3`), `xunit.runner.visualstudio` 4.0.1, `Microsoft.NET.Test.Sdk` 18.11.0 and `coverlet.collector` 10.1.0; the new analyzer rules xUnit2029 and xUnit2031 are fixed in the tests. - Template editor: with the individual Syncfusion packages the host page loads the Syncfusion script from `_content/Syncfusion.Blazor.Core/scripts/…` (the umbrella package `Syncfusion.Blazor` and its `_content/Syncfusion.Blazor/…` path are gone). The new test `EditorHostStaticAssetsTests` checks that every `_content/…` address in the host page is served by the editor, so a replaced package cannot leave a dead script reference. Celý seznam změn: CHANGELOG.md v balíčku a https://dev.azure.com/advsoft/Knihovny/_git/NetReporter?path=/src/NetReporter/CHANGELOG.md

Version Downloads Last updated
3.9.2 4 10/28/2026
3.9.1 1 10/27/2026
3.9.0 8 10/20/2026
3.8.1 3 10/19/2026
3.8.0 3 10/19/2026
3.7.0 3 10/19/2026
3.6.0 4 10/17/2026
3.5.1 4 10/15/2026
3.5.0 4 10/15/2026
3.4.2 4 10/15/2026
3.4.0 4 10/12/2026
3.3.0 4 10/11/2026
3.2.2 4 10/10/2026
3.2.1 4 10/10/2026
3.2.0 4 10/10/2026
3.1.1 4 10/09/2026
3.1.0 4 10/09/2026
3.0.1 4 10/08/2026
3.0.0 4 10/08/2026
2.2.1 5 10/05/2026
2.2.0 4 10/05/2026
2.1.0 4 10/04/2026
2.0.1 4 10/04/2026
2.0.0 4 10/03/2026
1.7.0 4 10/03/2026