BlazorReports 0.25.1
dotnet add package BlazorReports --version 0.25.1
NuGet\Install-Package BlazorReports -Version 0.25.1
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="BlazorReports" Version="0.25.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlazorReports" Version="0.25.1" />
<PackageReference Include="BlazorReports" />
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 BlazorReports --version 0.25.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BlazorReports, 0.25.1"
#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.
#addin nuget:?package=BlazorReports&version=0.25.1
#tool nuget:?package=BlazorReports&version=0.25.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Blazor Reports
Generate PDF reports using Blazor Components. Easily create a report server or generate reports from existing projects.
Requirements
- .NET 8.0 or later for report server
- .NET 6.0 or later for Blazor Components shared library
- Chrome, Chromium, or Edge browser for report generation
Basic usage for report server
- Install the Blazor Reports NuGet package:
dotnet add package BlazorReports
- Configure Blazor Reports and map the component:
var builder = WebApplication.CreateSlimBuilder(args); builder.Services.AddBlazorReports(); // Configure BlazorReports var app = builder.Build(); app.MapBlazorReport<MyBlazorComponent>(); // Map Blazor Component app.MapBlazorReport<OtherBlazorComponent, MyDataDto>(); // Map Blazor Component and receive data app.Run();
- Send HTTP POST request to the Blazor Reports endpoint:
POST /MyBlazorComponent POST /OtherBlazorComponent Content-Type: application/json { "text": "Hello World!" }
- Get back PDF Report.
Sample Blazor Components
// MyBlazorComponent: Basic component
<h3>Hello World!</h3>
@code {
}
// OtherBlazorComponent: Component that receives data
<h3>@Data?.Text</h3>
@code {
[Parameter]
public required MyDataDto Data { get; set; }
}
Advanced usage
Add Base styles
- Configure base styles file in options for AddBlazorReports:
var builder = WebApplication.CreateSlimBuilder(args); builder.Services.AddBlazorReports(options => { options.BaseStylesPath = "wwwroot/styles/base.css"; }); var app = builder.Build(); app.MapBlazorReport<MyBlazorComponent>(); app.Run();
- Configured components will now have the base styles applied.
Configure Tailwind CSS V4
- Add Tailwind to the root of your repository:
bun install tailwindcss @tailwindcss/cli
- Add 'wwwroot/tailwindcss/input.css' file to your project:
@import "tailwindcss";
- Add a watch and build script to your package.json for convenience:
{ "scripts": { "tailwind-watch": "tailwindcss -i ./path_to_your_project/wwwroot/tailwindcss/input.css -o ./path_to_your_project/wwwroot/styles/base.css -m --watch", "tailwind-build": "tailwindcss -i ./path_to_your_project/wwwroot/tailwindcss/input.css -o ./path_to_your_project/wwwroot/styles/base.css -m" }, "dependencies": { "@tailwindcss/cli": "^4.0.14", "tailwindcss": "^4.0.14" } }
- Use the following command to generate the base.css file:
bun run tailwind-build # To build once bun run tailwind-watch # To watch for changes
- Alternatively, use the tailwind cli to generate the base.css file:
bunx @tailwindcss/cli -i ./path_to_your_project/wwwroot/tailwindcss/input.css -o ./path_to_your_project/wwwroot/styles/base.css -m --watch
- Finally, configure BaseStyles in the Program.cs:
var builder = WebApplication.CreateSlimBuilder(args); builder.Services.AddBlazorReports(options => { options.BaseStylesPath = "wwwroot/styles/base.css"; }); var app = builder.Build(); app.MapBlazorReport<MyBlazorComponent>(); app.Run();
Configure assets
- Configure assets in Program.cs:
var builder = WebApplication.CreateSlimBuilder(args); builder.Services.AddBlazorReports(options => { options.AssetsPath = "wwwroot/assets"; }); var app = builder.Build(); app.MapBlazorReport<MyBlazorComponent>(); app.Run();
- Add inheritance for BlazorReportsComponentBase:
@inherits BlazorReports.Components.BlazorReportsBase <img src="@GlobalAssets.GetValueOrDefault("logo-salud.png")"/> @code { }
- All files will be available as base64 strings in the 'GlobalAssets' dictionary.
OpenAPI, Swagger, Authentication, Authorization, Validation, etc.
Blazor reports utilizes Minimal APIs under the hood and can be configured as any other Minimal API project.
For example, to add OpenAPI and Swagger:
- Add OpenAPI and Swagger NuGet packages.
- Configure OpenAPI and Swagger:
var builder = WebApplication.CreateSlimBuilder(args); builder.Services.AddBlazorReports(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); app.UseSwagger(); app.UseSwaggerUI(); app.MapBlazorReport<MyComponent, MyComponentData>(); app.MapBlazorReport<MyOtherComponent>(); app.Run();
- Open Swagger UI at '/swagger' endpoint.
- You can see each report endpoint configured with expected data model.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- BlazorReports.Components (>= 0.25.1)
- OneOf (>= 3.0.271)
-
net9.0
- BlazorReports.Components (>= 0.25.1)
- OneOf (>= 3.0.271)
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.25.1 | 137 | 4/8/2025 |
0.25.0 | 151 | 3/20/2025 |
0.24.0 | 157 | 11/19/2024 |
0.23.0 | 466 | 8/24/2024 |
0.22.0 | 325 | 5/22/2024 |
0.21.0 | 126 | 5/19/2024 |
0.20.0 | 841 | 10/27/2023 |
0.19.0 | 689 | 8/28/2023 |
0.18.0 | 652 | 8/22/2023 |
0.17.0 | 637 | 8/8/2023 |
0.16.0 | 708 | 8/3/2023 |
0.15.0 | 669 | 8/3/2023 |
0.14.0 | 706 | 7/25/2023 |
0.13.0 | 716 | 7/11/2023 |
0.12.0 | 710 | 6/27/2023 |
0.11.0 | 690 | 6/26/2023 |
0.10.0 | 695 | 6/24/2023 |
0.9.0 | 717 | 6/23/2023 |
0.8.0 | 706 | 6/23/2023 |
0.7.0 | 683 | 6/23/2023 |
0.6.0 | 741 | 6/7/2023 |
0.5.0 | 750 | 6/6/2023 |
0.4.0 | 700 | 6/4/2023 |
0.3.0 | 662 | 6/4/2023 |
0.2.0 | 711 | 5/31/2023 |
0.1.0 | 688 | 5/30/2023 |