Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
7650bf2869 | |||
184e97fce3 |
@ -700,7 +700,6 @@ public class ECNController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !NET8
|
#if !NET8
|
||||||
|
|
||||||
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step, bool isTECN, bool isEmergrncyTECN) {
|
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step, bool isTECN, bool isEmergrncyTECN) {
|
||||||
int isITARCompliant = 0;
|
int isITARCompliant = 0;
|
||||||
ECN ecn = new ECN();
|
ECN ecn = new ECN();
|
||||||
@ -946,11 +945,13 @@ public class ECNController : Controller {
|
|||||||
try {
|
try {
|
||||||
#if !NET8
|
#if !NET8
|
||||||
ViewEngineResult viewResult = ViewEngines.Engines.FindView(ControllerContext, viewName, string.Empty);
|
ViewEngineResult viewResult = ViewEngines.Engines.FindView(ControllerContext, viewName, string.Empty);
|
||||||
if (viewResult is null)
|
if (viewResult is null) {
|
||||||
return $"A view with the name '{viewName}' could not be found";
|
return $"A view with the name '{viewName}' could not be found";
|
||||||
|
}
|
||||||
ViewContext viewContext = new(ControllerContext, viewResult.View, ViewData, TempData, writer);
|
ViewContext viewContext = new(ControllerContext, viewResult.View, ViewData, TempData, writer);
|
||||||
viewResult.View.Render(viewContext, writer);
|
viewResult.View.Render(viewContext, writer);
|
||||||
result = writer.GetStringBuilder().ToString();
|
string htmlText = writer.GetStringBuilder().ToString();
|
||||||
|
result = htmlText.Replace("navbar-header", "navbar-header-hidden");
|
||||||
#endif
|
#endif
|
||||||
#if NET8
|
#if NET8
|
||||||
ViewEngineResult viewResult;
|
ViewEngineResult viewResult;
|
||||||
|
@ -243,11 +243,13 @@ public class LotTravelerController : Controller {
|
|||||||
try {
|
try {
|
||||||
#if !NET8
|
#if !NET8
|
||||||
ViewEngineResult viewResult = ViewEngines.Engines.FindView(ControllerContext, viewName, string.Empty);
|
ViewEngineResult viewResult = ViewEngines.Engines.FindView(ControllerContext, viewName, string.Empty);
|
||||||
if (viewResult is null)
|
if (viewResult is null) {
|
||||||
return $"A view with the name '{viewName}' could not be found";
|
return $"A view with the name '{viewName}' could not be found";
|
||||||
|
}
|
||||||
ViewContext viewContext = new(ControllerContext, viewResult.View, ViewData, TempData, writer);
|
ViewContext viewContext = new(ControllerContext, viewResult.View, ViewData, TempData, writer);
|
||||||
viewResult.View.Render(viewContext, writer);
|
viewResult.View.Render(viewContext, writer);
|
||||||
result = writer.GetStringBuilder().ToString();
|
string htmlText = writer.GetStringBuilder().ToString();
|
||||||
|
result = htmlText.Replace("navbar-header", "navbar-header-hidden");
|
||||||
#endif
|
#endif
|
||||||
#if NET8
|
#if NET8
|
||||||
ViewEngineResult viewResult;
|
ViewEngineResult viewResult;
|
||||||
|
@ -326,6 +326,9 @@
|
|||||||
<Compile Include="Models\WinEventLogModel.cs" />
|
<Compile Include="Models\WinEventLogModel.cs" />
|
||||||
<Compile Include="Models\WorkFlowModels.cs" />
|
<Compile Include="Models\WorkFlowModels.cs" />
|
||||||
<Compile Include="PdfGenerator\BinaryContentResult.cs" />
|
<Compile Include="PdfGenerator\BinaryContentResult.cs" />
|
||||||
|
<Compile Include="PdfGenerator\FakeView.cs" />
|
||||||
|
<Compile Include="PdfGenerator\HtmlViewRenderer.cs" />
|
||||||
|
<Compile Include="PdfGenerator\PdfViewController.cs" />
|
||||||
<Compile Include="PdfGenerator\PrintHeaderFooter.cs" />
|
<Compile Include="PdfGenerator\PrintHeaderFooter.cs" />
|
||||||
<Compile Include="PdfGenerator\StandardPdfRenderer.cs" />
|
<Compile Include="PdfGenerator\StandardPdfRenderer.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
0
Fab2ApprovalSystem/PdfGenerator/FakeView.cs
Normal file
0
Fab2ApprovalSystem/PdfGenerator/FakeView.cs
Normal file
0
Fab2ApprovalSystem/PdfGenerator/HtmlViewRenderer.cs
Normal file
0
Fab2ApprovalSystem/PdfGenerator/HtmlViewRenderer.cs
Normal file
1
Fab2ApprovalSystem/PdfGenerator/PdfViewController.cs
Normal file
1
Fab2ApprovalSystem/PdfGenerator/PdfViewController.cs
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
@ -15,11 +15,10 @@ public class StandardPdfRenderer {
|
|||||||
|
|
||||||
public static byte[] GetPortableDocumentFormatBytes(string pageTitle, string htmlText) {
|
public static byte[] GetPortableDocumentFormatBytes(string pageTitle, string htmlText) {
|
||||||
byte[] results;
|
byte[] results;
|
||||||
using (MemoryStream memoryStream = GetPortableDocumentFormat(pageTitle, htmlText)) {
|
MemoryStream memoryStream = GetPortableDocumentFormat(pageTitle, htmlText);
|
||||||
results = new byte[memoryStream.Position];
|
results = new byte[memoryStream.Position];
|
||||||
memoryStream.Position = 0;
|
memoryStream.Position = 0;
|
||||||
memoryStream.Read(results, 0, results.Length);
|
memoryStream.Read(results, 0, results.Length);
|
||||||
}
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,14 +34,13 @@ public class StandardPdfRenderer {
|
|||||||
MemoryStream result = new();
|
MemoryStream result = new();
|
||||||
#if !NET8
|
#if !NET8
|
||||||
using (Document pdfDocument = new Document(PageSize.A4, HorizontalMargin, HorizontalMargin, VerticalMargin, VerticalMargin)) {
|
using (Document pdfDocument = new Document(PageSize.A4, HorizontalMargin, HorizontalMargin, VerticalMargin, VerticalMargin)) {
|
||||||
using (PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDocument, result)) {
|
PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDocument, result);
|
||||||
pdfWriter.CloseStream = false;
|
pdfWriter.CloseStream = false;
|
||||||
pdfWriter.PageEvent = new PrintHeaderFooter { Title = pageTitle };
|
pdfWriter.PageEvent = new PrintHeaderFooter { Title = pageTitle };
|
||||||
pdfDocument.Open();
|
pdfDocument.Open();
|
||||||
using (StringReader htmlViewReader = new StringReader(htmlText)) {
|
using (StringReader htmlViewReader = new StringReader(htmlText)) {
|
||||||
using (HTMLWorker htmlWorker = new HTMLWorker(pdfDocument)) {
|
using (HTMLWorker htmlWorker = new HTMLWorker(pdfDocument)) {
|
||||||
htmlWorker.Parse(htmlViewReader);
|
htmlWorker.Parse(htmlViewReader);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user