diff --git a/docs/8.0/ayanova/docs/ops-error-codes.md b/docs/8.0/ayanova/docs/ops-error-codes.md index d16146aa..29e534bf 100644 --- a/docs/8.0/ayanova/docs/ops-error-codes.md +++ b/docs/8.0/ayanova/docs/ops-error-codes.md @@ -15,7 +15,7 @@ Here are all the error codes that can be returned by the AyaNova server: | ----- | ------------------------------ | | E1000 | Could not connect to the database specified in the [connection string](ops-config-db.md). | | E1010 | Could not find wwwRoot folder. AyaNova must be started from the folder immediately above wwwRoot. Generally the start folder should be the same folder as AyaNova.dll file. | -| E1012 | Missing resource folder. AyaNova was started from the wrong location or the resource folder was not installed properly. This is required to intialize a new AyaNova database | +| E1012 | Missing resource folder. AyaNova was started from the wrong location or was not installed properly. | | E1013 | Missing translation resource file was deleted, renamed or not installed correctly. Resource translation files are required to load into a new AyaNova database to display text in several translations for the user interface | | E1015 | Missing translation. One or more of the stock translations were not found in the database or a custom translation specified in the config setting [AYANOVA_DEFAULT_TRANSLATION](ops-config-default-translation.md) is missing from the database. Log will have details. | | E1020 | Licensing related error. The message will contain the explanation | diff --git a/server/AyaNova/Controllers/ReportController.cs b/server/AyaNova/Controllers/ReportController.cs index ec6882ed..7eab5771 100644 --- a/server/AyaNova/Controllers/ReportController.cs +++ b/server/AyaNova/Controllers/ReportController.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; +using System.IO; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Authorization; @@ -8,6 +9,7 @@ using AyaNova.Models; using AyaNova.Api.ControllerHelpers; using AyaNova.Biz; using AyaNova.Util; + using PuppeteerSharp; namespace AyaNova.Api.Controllers @@ -79,16 +81,16 @@ namespace AyaNova.Api.Controllers if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - // byte[] buffer = readfromdatabase(); - // return new FileContentResult(buffer, "text/html"); + var ReportJSFolderPath = Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource", "reportjs"); + if (!Directory.Exists(ReportJSFolderPath)) + throw new System.Exception($"E1012: \"reportjs\" folder not found where expected: \"{ReportJSFolderPath}\", installation damaged?"); + var hbspath = Path.Combine(ReportJSFolderPath, "ayhandlebars.js"); + if (!System.IO.File.Exists(hbspath)) + throw new System.Exception($"E1012: \"ayhandlebars.js\" file not found where expected: \"{hbspath}\", installation damaged?"); - //first test, just render a web page to pdf and return it - //return PhysicalFile(filePath, mimetype, dbObject.DisplayFileName); - //http://www.puppeteersharp.com/api/index.html - //https://github.com/hardkoded/puppeteer-sharp await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision); //sample CSS @@ -101,15 +103,29 @@ namespace AyaNova.Api.Controllers margin: 2cm; }"; - //sample HTML - var templateHtml = "