From f4559362a3f748d7dcd191a0c5439f19866cd670 Mon Sep 17 00:00:00 2001 From: Perea Date: Mon, 1 Sep 2025 10:35:23 +0200 Subject: [PATCH] imprimir arreglado --- .../Components/Pages/HerramientaCASAS.razor | 27 ++++++++++--------- .../Components/Pages/HerramientaURBAN.razor | 7 ++--- .../Components/Pages/Licitaciones.razor | 13 ++++----- .../Components/Pages/LicitacionesURBAN.razor | 7 ++--- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/HerramientaCASA/Components/Pages/HerramientaCASAS.razor b/HerramientaCASA/Components/Pages/HerramientaCASAS.razor index 49aa017..a5601af 100644 --- a/HerramientaCASA/Components/Pages/HerramientaCASAS.razor +++ b/HerramientaCASA/Components/Pages/HerramientaCASAS.razor @@ -293,26 +293,27 @@ var contenidoHtml = await JSA.InvokeAsync("obtenerPDFImprimir", "DespachoImprimir"); var fullHtml = $@" - - - - - - - {contenidoHtml} - - "; + + + + + + + {contenidoHtml} + + "; var browserFetcher = new BrowserFetcher(); - await browserFetcher.DownloadAsync(); + var revisionInfo = await browserFetcher.DownloadAsync(); - using var browser = await Puppeteer.LaunchAsync(new LaunchOptions + var browser = await Puppeteer.LaunchAsync(new LaunchOptions { + ExecutablePath = revisionInfo.GetExecutablePath(), Headless = true, - Args = new[] { "--ignore-certificate-errors" } + Args = new[] { "--no-sandbox", "--disable-setuid-sandbox", "--ignore-certificate-errors" } }); - + using var page = await browser.NewPageAsync(); await page.SetViewportAsync(new ViewPortOptions { Width = 1200, Height = 800 }); diff --git a/HerramientaCASA/Components/Pages/HerramientaURBAN.razor b/HerramientaCASA/Components/Pages/HerramientaURBAN.razor index 7680432..709fa31 100644 --- a/HerramientaCASA/Components/Pages/HerramientaURBAN.razor +++ b/HerramientaCASA/Components/Pages/HerramientaURBAN.razor @@ -284,12 +284,13 @@ var filePath = Path.Combine("wwwroot", fileName); var browserFetcher = new BrowserFetcher(); - await browserFetcher.DownloadAsync(); + var revisionInfo = await browserFetcher.DownloadAsync(); - using var browser = await Puppeteer.LaunchAsync(new LaunchOptions + var browser = await Puppeteer.LaunchAsync(new LaunchOptions { + ExecutablePath = revisionInfo.GetExecutablePath(), Headless = true, - Args = new[] { "--ignore-certificate-errors" } + Args = new[] { "--no-sandbox", "--disable-setuid-sandbox", "--ignore-certificate-errors" } }); using var page = await browser.NewPageAsync(); diff --git a/HerramientaCASA/Components/Pages/Licitaciones.razor b/HerramientaCASA/Components/Pages/Licitaciones.razor index 5e410c2..d858048 100644 --- a/HerramientaCASA/Components/Pages/Licitaciones.razor +++ b/HerramientaCASA/Components/Pages/Licitaciones.razor @@ -414,13 +414,14 @@ "; var browserFetcher = new BrowserFetcher(); - await browserFetcher.DownloadAsync(); + var revisionInfo = await browserFetcher.DownloadAsync(); - using var browser = await Puppeteer.LaunchAsync(new LaunchOptions - { - Headless = true, - Args = new[] { "--ignore-certificate-errors" } - }); + var browser = await Puppeteer.LaunchAsync(new LaunchOptions + { + ExecutablePath = revisionInfo.GetExecutablePath(), + Headless = true, + Args = new[] { "--no-sandbox", "--disable-setuid-sandbox", "--ignore-certificate-errors" } + }); using var page = await browser.NewPageAsync(); diff --git a/HerramientaCASA/Components/Pages/LicitacionesURBAN.razor b/HerramientaCASA/Components/Pages/LicitacionesURBAN.razor index 3a295b6..77620c3 100644 --- a/HerramientaCASA/Components/Pages/LicitacionesURBAN.razor +++ b/HerramientaCASA/Components/Pages/LicitacionesURBAN.razor @@ -493,12 +493,13 @@ var filePath = Path.Combine("wwwroot", fileName); var browserFetcher = new BrowserFetcher(); - await browserFetcher.DownloadAsync(); + var revisionInfo = await browserFetcher.DownloadAsync(); - using var browser = await Puppeteer.LaunchAsync(new LaunchOptions + var browser = await Puppeteer.LaunchAsync(new LaunchOptions { + ExecutablePath = revisionInfo.GetExecutablePath(), Headless = true, - Args = new[] { "--ignore-certificate-errors" } + Args = new[] { "--no-sandbox", "--disable-setuid-sandbox", "--ignore-certificate-errors" } }); using var page = await browser.NewPageAsync();