Skip to content

RotativaHQ/rotativaio.netcore

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

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. use one of the helper's async methods to create PDF files.

var template = "Hello @Model.Name";
var model = new TestModel { Name = "Giorgio" };
using (var pdfHelper = new PdfHelper(rotativaioKey, "https://eunorth.rotativahq.com"))
{ 

    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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages