This commit is contained in:
@@ -417,12 +417,12 @@ namespace AyaNova.Biz
|
||||
|
||||
//Default timeout for each operation of report generation
|
||||
var WaitTimeout = new WaitForFunctionOptions() { Timeout = ServerBootConfig.REPORT_RENDERING_OPERATION_TIMEOUT };
|
||||
|
||||
|
||||
//includeWoItemDescendants?
|
||||
reportRequest.IncludeWoItemDescendants = report.IncludeWoItemDescendants;
|
||||
|
||||
//Get data
|
||||
var ReportData = await GetReportData(reportRequest);//SLOW
|
||||
var ReportData = await GetReportData(reportRequest);//###### TODO: SLOW NEEDS TIMEOUT HERE ONCE IT WORKS IS SUPPORTED
|
||||
//if GetReportData errored then will return null so need to return that as well here
|
||||
if (ReportData == null)
|
||||
{
|
||||
@@ -478,6 +478,9 @@ namespace AyaNova.Biz
|
||||
using (var browser = await Puppeteer.LaunchAsync(lo))
|
||||
using (var page = await browser.NewPageAsync())
|
||||
{
|
||||
|
||||
|
||||
|
||||
//see catch block
|
||||
// var ChromiumProcessID = browser.Process.Id;
|
||||
|
||||
@@ -589,18 +592,16 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
|
||||
#if (DEBUG)
|
||||
//view page contents
|
||||
var pagecontent = await page.GetContentAsync();
|
||||
// #if (DEBUG)
|
||||
// //view page contents
|
||||
// var pagecontent = await page.GetContentAsync();
|
||||
|
||||
#endif
|
||||
// #endif
|
||||
//prePareData / preRender
|
||||
var ReportDataObject = $"{{ ayReportData:{ReportData}, ayReportMetaData:{reportMeta}, ayClientMetaData:{clientMeta}, ayServerMetaData:{serverMeta} }}";
|
||||
log.LogDebug($"Calling ayPreRender...");
|
||||
|
||||
//PRE_RENDER WITH TIMEOUT
|
||||
//Note: defaults to 30 seconds, going to leave that in as the default
|
||||
//in future may need to adjust but would probably do it in the context of a setting of some kind
|
||||
await page.WaitForExpressionAsync($"ayPreRender({ReportDataObject})", WaitTimeout);
|
||||
|
||||
//compile the template
|
||||
@@ -628,6 +629,7 @@ namespace AyaNova.Biz
|
||||
//https://pptr.dev/#?product=Puppeteer&version=v5.3.0&show=api-pagepdfoptions
|
||||
log.LogDebug($"Resolving PDF Options from report settings");
|
||||
var PdfOptions = new PdfOptions() { };
|
||||
|
||||
PdfOptions.DisplayHeaderFooter = report.DisplayHeaderFooter;
|
||||
if (report.DisplayHeaderFooter)
|
||||
{
|
||||
@@ -699,7 +701,7 @@ namespace AyaNova.Biz
|
||||
|
||||
//render to pdf and return
|
||||
log.LogDebug($"Calling render page contents to PDF");
|
||||
await page.PdfAsync(outputFullPath, PdfOptions);//SLOW
|
||||
await page.PdfAsync(outputFullPath, PdfOptions);//###### TODO: SLOW NEEDS TIMEOUT HERE ONCE SUPPORTED, open bug: https://github.com/hardkoded/puppeteer-sharp/issues/1710
|
||||
|
||||
log.LogDebug($"Completed, returning results");
|
||||
return outputFileName;
|
||||
|
||||
Reference in New Issue
Block a user