Test Reportes con Razor y Puppeteer
All checks were successful
Build and Deploy / remote-build-and-deploy (push) Successful in 28m23s
All checks were successful
Build and Deploy / remote-build-and-deploy (push) Successful in 28m23s
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using PuppeteerSharp.Media;
|
||||
|
||||
namespace GestionIntegral.Api.Services.Pdf
|
||||
{
|
||||
/// <summary>
|
||||
/// Define las opciones de configuración para la generación de un PDF.
|
||||
/// </summary>
|
||||
public class PdfGenerationOptions
|
||||
{
|
||||
public PaperFormat? Format { get; set; } = PaperFormat.A4;
|
||||
public MarginOptions? Margin { get; set; }
|
||||
public string? HeaderTemplate { get; set; }
|
||||
public string? FooterTemplate { get; set; }
|
||||
public bool PrintBackground { get; set; } = true;
|
||||
public bool Landscape { get; set; } = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Servicio para generar documentos PDF a partir de plantillas Razor.
|
||||
/// </summary>
|
||||
public interface IPdfGeneratorService
|
||||
{
|
||||
/// <summary>
|
||||
/// Genera un archivo PDF a partir de una plantilla Razor y un modelo de datos.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">El tipo del modelo de datos.</typeparam>
|
||||
/// <param name="templatePath">La ruta relativa de la plantilla Razor (ej: "Controllers/Reportes/Templates/MiReporte.cshtml").</param>
|
||||
/// <param name="model">El objeto con los datos para rellenar la plantilla.</param>
|
||||
/// <param name="options">Opciones de configuración para el PDF (márgenes, formato, etc.).</param>
|
||||
/// <returns>Un array de bytes representando el archivo PDF generado.</returns>
|
||||
Task<byte[]> GeneratePdfFromRazorTemplateAsync<T>(string templatePath, T model, PdfGenerationOptions? options = null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user