iPdfWriter.AspNetCore, extends iPdfWriter to work in AspNetCore projects, contains extension methods to download PdfInput instances as well as OutputResult, facilitating its use in this environment.
I hope it helps someone. 😏
- From nuget gallery
- From package manager console
PM> Install-Package iPdfWriter.AspNetCore
- Adds HttpContextAccessor service.
...
...
builder.Services.AddHttpContextAccessor();
...
...
[ApiController]
[Route("[controller]")]
public class AdobeReportByExtensionController : ControllerBase
{
private readonly IHttpContextAccessor _context;
public AdobeReportByExtensionController(IHttpContextAccessor context)
{
_context = context;
}
[HttpGet]
public async Task GetAsync()
{
var downloadResult = await (await Sample01.GenerateAsync()).DownloadAsync(context: _context.HttpContext);
if (!downloadResult.Success)
{
// Handle error(s)
}
}
}
- Adds HttpContextAccessor service.
...
...
builder.Services.AddHttpContextAccessor();
...
...
[ApiController]
[Route("[controller]")]
public class AdobeReportByActionController : ControllerBase
{
private readonly IHttpContextAccessor _context;
public AdobeReportByActionController(IHttpContextAccessor context)
{
_context = context;
}
[HttpGet]
public async Task GetAsync()
{
var result = await Sample01.GenerateAsync();
if (result.Success)
{
var safeOutputData = result.Result;
var downloadResult = await safeOutputData.Action(new DownloadAsync { Context = _context.HttpContext });
if (!downloadResult.Success)
{
// Handle error(s)
}
}
}
}
- Please see next link documentation
If you have found iPdfWriter.AspNetCore useful at work or in a personal project, I would love to hear about it. If you have decided not to use iPdfWriter.AspNetCore, please send me and email stating why this is so. I will use this feedback to improve iPdfWriter.AspNetCore in future releases.
My email address is