|
@@ -2,6 +2,7 @@
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using PuppeteerSharp;
|
|
|
+using PuppeteerSharp.Media;
|
|
|
using System.Runtime.InteropServices;
|
|
|
using System.Text;
|
|
|
using System.Text.Json;
|
|
@@ -175,13 +176,18 @@ namespace HTEXScreen.Controllers
|
|
|
Headless = true,
|
|
|
Args = new string[] { "--no-sandbox", "--disable-setuid-sandbox" }
|
|
|
});
|
|
|
-
|
|
|
+ double unitPX = 37.7813;
|
|
|
ViewPortOptions viewPortOptions = new ViewPortOptions
|
|
|
{
|
|
|
- Width = screenshot.width,
|
|
|
- Height = screenshot.height
|
|
|
+ // Width = (int)Math.Ceiling(unitPX * 21),
|
|
|
+ // Height = (int)Math.Ceiling(unitPX * 29.7 * 1)
|
|
|
};
|
|
|
- PdfOptions pdfOptions = new PdfOptions { DisplayHeaderFooter = true, PreferCSSPageSize =true};
|
|
|
+ //ViewPortOptions viewPortOptions = new ViewPortOptions
|
|
|
+ //{
|
|
|
+ // Width = screenshot.width,
|
|
|
+ // Height = screenshot.height
|
|
|
+ //};
|
|
|
+ PdfOptions pdfOptions = new PdfOptions { DisplayHeaderFooter = true,FooterTemplate="", PreferCSSPageSize =true,Format= PaperFormat .A4};
|
|
|
//ScreenshotOptions screenshotOptions= new ScreenshotOptions { FullPage = fullPage, BurstMode = true };
|
|
|
List<string> urls = new List<string>();
|
|
|
|
|
@@ -246,7 +252,7 @@ namespace HTEXScreen.Controllers
|
|
|
});
|
|
|
for (int i = 0; i < urls.Count; i++)
|
|
|
{
|
|
|
- responses.Add(page_tasks[i].GoToAsync(System.Web.HttpUtility.UrlDecode(urls[i]), WaitUntilNavigation.Networkidle2));
|
|
|
+ responses.Add(page_tasks[i].GoToAsync(urls[i], WaitUntilNavigation.Networkidle2));
|
|
|
}
|
|
|
var responses_tasks = await Task.WhenAll(responses);
|
|
|
//List<Task<Stream>> streams = new List<Task<Stream>>();
|