RotativaIO.NetCore
1.2.0-beta.1
dotnet add package RotativaIO.NetCore --version 1.2.0-beta.1
NuGet\Install-Package RotativaIO.NetCore -Version 1.2.0-beta.1
<PackageReference Include="RotativaIO.NetCore" Version="1.2.0-beta.1" />
<PackageVersion Include="RotativaIO.NetCore" Version="1.2.0-beta.1" />
<PackageReference Include="RotativaIO.NetCore" />
paket add RotativaIO.NetCore --version 1.2.0-beta.1
#r "nuget: RotativaIO.NetCore, 1.2.0-beta.1"
#:package RotativaIO.NetCore@1.2.0-beta.1
#addin nuget:?package=RotativaIO.NetCore&version=1.2.0-beta.1&prerelease
#tool nuget:?package=RotativaIO.NetCore&version=1.2.0-beta.1&prerelease
RotativaIO.NetCore
This library let's you use rotativa.io to create PDF files using Razor templates without requiring to reference Asp.Net Core libraries. This makes it suitable to be used in console applications or Azure Functions
This requires a valid rotativa.io account. You can grab a (limited) free account or subscribe a paid plan.
Usage is dead simple:
Install the nuget package
Install-package RotativaIO.NetCore
Create a new PdfHelper object passing your account's ApiKey and your chosen endpoint (both are shown in your rotativa.io dashboard). Use one of the helper's async methods to create PDF files.
Keep the ApiKey and endpoint out of source code: read them from configuration, environment variables or a secret store (e.g. Azure Key Vault).
var rotativaioKey = configuration["RotativaIOKey"];
var rotativaioEndpoint = configuration["RotativaIOEndpoint"]; // must be an https URL
var template = "Hello @Model.Name";
var model = new TestModel { Name = "World" };
using (var pdfHelper = new PdfHelper(rotativaioKey, rotativaioEndpoint))
{
var pdfBytes = await pdfHelper.GetPdfAsByteArray(
template,
model,
new RotativaOptions
{
PageSize = Size.A5
});
/// do something with it, like, for example, send the PDF via email
}
You can find a code example in the demo Azure function project (copy local.settings.example.json to local.settings.json and fill in your own values).
Security notes
- Endpoints must use https. The API key is sent with every request, so plain
httpendpoints are rejected (except loopback addresses for local testing). - Templates are code. Razor templates are compiled to C# and executed in your process. Only use templates you trust; never build a template from user input.
- Model values are not HTML-encoded.
@Model.Xwrites values verbatim. If a value may come from users, encode it first (e.g.System.Net.WebUtility.HtmlEncode) to avoid HTML/script injection into the generated PDF.
Running the tests
Unit tests run offline. The integration test against the live service runs only when these environment variables are set:
export ROTATIVAIO_APIKEY=<your api key>
export ROTATIVAIO_URL=<your endpoint>
dotnet test
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 was computed. 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. net10.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.4)
- RazorEngineCore (>= 2026.1.1)
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 |
|---|---|---|
| 1.2.0-beta.1 | 46 | 11/25/2026 |
| 1.2.0-beta | 3,115 | 1/18/2021 |
| 1.1.0 | 8,430 | 7/29/2020 |
| 1.0.0 | 928 | 7/29/2020 |
Security update: Newtonsoft.Json 13.0.4 (GHSA-5crp-9r3c-p9vr), RazorEngineCore 2026.1.1, HTTPS-only endpoints, shared HttpClient, HTTP status checks.