se confia en sergio
This commit is contained in:
@@ -376,18 +376,7 @@
|
||||
|
||||
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 cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css");
|
||||
var cssContent = await File.ReadAllTextAsync(cssPath);
|
||||
|
||||
var contenidoHtml = await JSA.InvokeAsync<string>("obtenerPDFImprimir", "DespachoImprimir");
|
||||
@@ -404,21 +393,13 @@
|
||||
</html>";
|
||||
|
||||
|
||||
var arrayPDF = PdfService.GenerarPdf("fullHtml");
|
||||
var arrayPDF = PdfService.GenerarPdf(fullHtml);
|
||||
|
||||
|
||||
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -11,14 +11,17 @@ 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)
|
||||
public byte[] GenerarPdf(string html)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -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()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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-;"
|
||||
|
||||
@@ -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
|
||||
|
||||
21
HerramientaCASA/wwwroot/Imprimir/header.html
Normal file
21
HerramientaCASA/wwwroot/Imprimir/header.html
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user