Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Minor changes - one pagination file for PDF documents

KrzysztofPajak3ba9870df8e1
diff --git a/src/Business/Grand.Business.Common/Services/Pdf/WkPdfService.cs b/src/Business/Grand.Business.Common/Services/Pdf/WkPdfService.cs
index c581d24b6..c76ae1d75 100644
--- a/src/Business/Grand.Business.Common/Services/Pdf/WkPdfService.cs
+++ b/src/Business/Grand.Business.Common/Services/Pdf/WkPdfService.cs
@@ -14,14 +14,14 @@ using Wkhtmltopdf.NetCore;
namespace Grand.Business.Common.Services.Pdf
{
/// <summary>
- /// Generate invoice products , shipment as pdf (from html template to pdf)
+ /// Generate invoice, shipment as pdf (from html template to pdf)
/// </summary>
public class WkPdfService : IPdfService
{
private const string _orderTemaplate = "~/Views/PdfTemplates/OrderPdfTemplate.cshtml";
private const string _shipmentsTemaplate = "~/Views/PdfTemplates/ShipmentPdfTemplate.cshtml";
- private const string _orderFooter = "pdf/footers/order.html";
- private const string _shipmentFooter = "pdf/footers/shipment.html";
+ private const string _paginationFooter = "assets/pdf/pagination.html";
+
private readonly IGeneratePdf _generatePdf;
private readonly IViewRenderService _viewRenderService;
private readonly ILanguageService _languageService;
@@ -50,7 +50,7 @@ namespace Grand.Business.Common.Services.Pdf
{
PageSize = Wkhtmltopdf.NetCore.Options.Size.A4,
PageMargins = new Wkhtmltopdf.NetCore.Options.Margins() { Bottom = 10, Left = 10, Right = 10, Top = 10 },
- FooterHtml = CommonPath.WebHostMapPath(_orderFooter)
+ FooterHtml = CommonPath.WebHostMapPath(_paginationFooter)
});
var html = await _viewRenderService.RenderToStringAsync<(IList<Order>,string)>(_orderTemaplate, new (orders, vendorId));
@@ -92,7 +92,7 @@ namespace Grand.Business.Common.Services.Pdf
{
PageSize = Wkhtmltopdf.NetCore.Options.Size.A4,
PageMargins = new Wkhtmltopdf.NetCore.Options.Margins() { Bottom = 10, Left = 10, Right = 10, Top = 10 },
- FooterHtml = CommonPath.WebHostMapPath(_shipmentFooter)
+ FooterHtml = CommonPath.WebHostMapPath(_paginationFooter)
});
var html = await _viewRenderService.RenderToStringAsync<IList<Shipment>>(_shipmentsTemaplate, shipments);
diff --git a/src/Web/Grand.Web/wwwroot/pdf/footers/order.html b/src/Web/Grand.Web/wwwroot/assets/pdf/pagination.html
similarity index 100%
rename from src/Web/Grand.Web/wwwroot/pdf/footers/order.html
rename to src/Web/Grand.Web/wwwroot/assets/pdf/pagination.html
diff --git a/src/Web/Grand.Web/wwwroot/pdf/footers/products.html b/src/Web/Grand.Web/wwwroot/pdf/footers/products.html
deleted file mode 100644
index 2ee310c58..000000000
--- a/src/Web/Grand.Web/wwwroot/pdf/footers/products.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <meta charset="utf-8">
- <script>
- function pagination()
- {
- var vars = {};
- var x = document.location.search.substring(1).split('&');
-
- for (var i in x)
- {
- var z = x[i].split('=', 2);
- vars[z[0]] = unescape(z[1]);
- }
-
- var x = ['frompage','topage','page','webpage','section','subsection','subsubsection'];
-
- for (var i in x)
- {
- var y = document.getElementsByClassName(x[i]);
-
- for (var j = 0; j < y.length; ++j)
- {
- y[j].textContent = vars[x[i]];
- }
- }
- }
- </script>
-</head>
-
-<body id="pdf-footer" onload="pagination()">
- <span class="copyright">
- © Copyright Grandnode. All rights reserved.
- </span>
- <span class="page" style="float:right"></span>
-</body>
-</html>
\ No newline at end of file
diff --git a/src/Web/Grand.Web/wwwroot/pdf/footers/shipment.html b/src/Web/Grand.Web/wwwroot/pdf/footers/shipment.html
deleted file mode 100644
index 414ab4968..000000000
--- a/src/Web/Grand.Web/wwwroot/pdf/footers/shipment.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!doctype html>
-<html>
-<head>
-
-
- <meta charset="utf-8">
-
- <script>
- function pagination()
- {
- var vars = {};
- var x = document.location.search.substring(1).split('&');
-
- for (var i in x)
- {
- var z = x[i].split('=', 2);
- vars[z[0]] = unescape(z[1]);
- }
-
- var x = ['frompage','topage','page','webpage','section','subsection','subsubsection'];
-
- for (var i in x)
- {
- var y = document.getElementsByClassName(x[i]);
-
- for (var j = 0; j < y.length; ++j)
- {
- y[j].textContent = vars[x[i]];
- }
- }
- }
- </script>
-</head>
-
-<body id="pdf-footer" onload="pagination()">
- <span class="copyright">
- © Copyright Grandnode. All rights reserved.
- </span>
- <span class="page" style="float:right"></span>
-</body>
-</html>
\ No newline at end of file