Der PSPDFKitLicenseKey-Schlüssel wurde aktualisiert, um den Lizenzcode aus appsettings.json an das Frontend zu übergeben.

This commit is contained in:
Developer 02 2024-05-07 10:14:45 +02:00
parent 79aa6f4cb3
commit b19cccdc34
5 changed files with 11 additions and 4 deletions

View File

@ -15,6 +15,7 @@ using EnvelopeGenerator.Application.Resources;
using EnvelopeGenerator.Application.DTOs;
using Microsoft.AspNetCore.Localization;
using Newtonsoft.Json.Linq;
using Microsoft.Extensions.Configuration;
namespace EnvelopeGenerator.Web.Controllers
{
@ -149,6 +150,9 @@ namespace EnvelopeGenerator.Web.Controllers
new ClaimsPrincipal(claimsIdentity),
authProperties);
//add PSPDFKit licence key
ViewData["PSPDFKitLicenseKey"] = _configuration["PSPDFKitLicenseKey"];
return View("ShowEnvelope", er);
},
Fail: (messages, notices) =>

View File

@ -78,7 +78,7 @@
var envelopeResponse = @Html.Raw(envelopeResponseJson);
document.addEventListener("DOMContentLoaded", async () => {
const app = new App("#app", "@ViewData["EnvelopeKey"]", envelopeResponse, documentArrayBuffer);
const app = new App("#app", "@ViewData["EnvelopeKey"]", envelopeResponse, documentArrayBuffer, "@ViewData["PSPDFKitLicenseKey"]");
await app.init();
})
</script>

View File

@ -8,6 +8,7 @@
"Microsoft.AspNetCore.Hosting.Diagnostics": "Warning"
}
},
"PSPDFKitLicenseKey": null,
"AdminPassword": "dd",
"AllowedOrigins": [ "https://localhost:7202" ],
"NLog": {

View File

@ -10,7 +10,7 @@ const ActionType = {
}
class App {
constructor(container, envelopeKey, envelopeResponse, documentBytes) {
constructor(container, envelopeKey, envelopeResponse, documentBytes, licenseKey) {
this.container = container
this.envelopeKey = envelopeKey
@ -24,6 +24,7 @@ class App {
this.signatureCount = 0
this.envelopeResponse = envelopeResponse;
this.documentBytes = documentBytes;
this.licenseKey = licenseKey;
}
// This function will be called from the ShowEnvelope.razor page
@ -48,7 +49,7 @@ class App {
const arrayBuffer = this.documentBytes
// Load PSPDFKit
this.Instance = await this.UI.loadPSPDFKit(arrayBuffer, this.container)
this.Instance = await this.UI.loadPSPDFKit(arrayBuffer, this.container, this.licenseKey)
this.UI.configurePSPDFKit(this.Instance, this.handleClick.bind(this))
this.Instance.addEventListener(

View File

@ -14,8 +14,9 @@
// Load the PSPDFKit UI by setting a target element as the container to render in
// and a arraybuffer which represents the document that should be displayed.
loadPSPDFKit(arrayBuffer, container) {
loadPSPDFKit(arrayBuffer, container, licenseKey) {
return PSPDFKit.load({
licenseKey: licenseKey,
styleSheets: ['/css/site.css'],
container: container,
document: arrayBuffer,