se confia en sergio

This commit is contained in:
2026-01-19 11:34:47 +01:00
parent 4cf2f94a7f
commit bb2147a22f
6 changed files with 38 additions and 32 deletions

View File

@@ -375,17 +375,6 @@
public async Task imprimir()
{
var a = PdfService.obtenerURL();
mensajes.Add(new ToastMessage
{
Type = ToastType.Danger,
Message = a,
});
try
{
var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css");
var cssContent = await File.ReadAllTextAsync(cssPath);
@@ -404,21 +393,13 @@
</html>";
var arrayPDF = PdfService.GenerarPdf("fullHtml");
var arrayPDF = PdfService.GenerarPdf(fullHtml);
string base64Pdf = Convert.ToBase64String(arrayPDF);
await JSA.InvokeVoidAsync("descargarPdf", "SimulacionHerramientaCASA_" + DateTime.Now , null);
}catch(Exception ex)
{
mensajes.Add(new ToastMessage
{
Type = ToastType.Danger,
Message = ex.Message,
});
}
await JSA.InvokeVoidAsync("descargarPdf", "SimulacionHerramientaCASA_" + DateTime.Now, base64Pdf);
}
}

View File

@@ -54,6 +54,7 @@ builder.Services.AddSession(options =>
options.Cookie.HttpOnly = true;
options.Cookie.IsEssential = true;
});
builder.Services.AddHttpClient();
builder.Services.AddBlazorBootstrap();
builder.Services.AddAntiforgery();
@@ -127,7 +128,7 @@ app.MapGet("/HeaderPdf", () =>
var bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: true);
var logoByte = bd.ficheros
.First(x => x.NombreFichero.Contains("LogoColegio2"))
.FirstOrDefault(x => x.NombreFichero.Contains("LogoColegio2"))
.Fichero;
var logoBase64 = Convert.ToBase64String(logoByte);

View File

@@ -11,11 +11,14 @@ namespace HerramientaCASA
{
private readonly IConverter _converter;
private readonly IWebHostEnvironment _env;
private readonly HttpClient _http;
public ServicioPDF(IConverter converter, IWebHostEnvironment env)
public ServicioPDF(IConverter converter, IWebHostEnvironment env, HttpClient http)
{
_converter = converter;
_env = env;
_http = http;
}
public byte[] GenerarPdf(string html)
@@ -40,9 +43,9 @@ namespace HerramientaCASA
HtmlContent = html,
HeaderSettings = new HeaderSettings
{
//HtmUrl = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Imprimir", "HeaderImprimir.html")
HtmUrl = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Imprimir", "HeaderImprimir.html")
//HtmUrl = "https://localhost:7275/HeaderPdf"
HtmUrl = obtenerURL()
//HtmUrl = obtenerURL()
},
}
}

View File

@@ -15,7 +15,7 @@
// CONEXIÓN COACYLE
//"WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;",
//"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;"
//"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;",
"WriteConnection": "Server=localhost;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;",
"ReadOnlyConnection": "Server=localhost;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;"

View File

@@ -9,7 +9,7 @@
<table style='width:100%; border:0; border-collapse:collapse;'>
<tr>
<td style='text-align: left; width: 50%; padding-left: 10px; padding-top:8px;'>
<img style='height: 40px; border-radius: 10px !important;' src='https://localhost/Imprimir/logoImprimir.jpeg' alt='Image'>
<!--<img style='height: 40px; border-radius: 10px !important;' src='https://localhost/Imprimir/logoImprimir.jpeg' alt='Image'>-->
</td>
<td style='text-align: right; width: 50%; padding: 10px;'>
Costes Asociados a los Servicios de Arquitectura - CASA

File diff suppressed because one or more lines are too long