From 32bace863c45df35e05bcb680cebb3c6afe233f3 Mon Sep 17 00:00:00 2001
From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
Date: Thu, 4 May 2023 23:22:33 +0100
Subject: [PATCH] undo wrong commit file for sign
---
.../controller/web/OtherWebController.java | 8 ++++
src/main/resources/templates/sign.html | 46 ++-----------------
2 files changed, 13 insertions(+), 41 deletions(-)
diff --git a/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java b/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java
index a7d17d76..48b1f8e1 100644
--- a/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java
+++ b/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java
@@ -37,6 +37,14 @@ public class OtherWebController {
return "other/extract-images";
}
+ @GetMapping("/flatten")
+ @Hidden
+ public String flattenForm(Model model) {
+ model.addAttribute("currentPage", "flatten");
+ return "other/flatten";
+ }
+
+
@GetMapping("/change-metadata")
@Hidden
diff --git a/src/main/resources/templates/sign.html b/src/main/resources/templates/sign.html
index 3ef8ef89..cc9d2dfc 100644
--- a/src/main/resources/templates/sign.html
+++ b/src/main/resources/templates/sign.html
@@ -60,11 +60,8 @@
-
-
-
@@ -75,11 +72,7 @@
-
-
-
-
-
+
@@ -96,7 +89,6 @@
document.addEventListener('DOMContentLoaded', () => {
const pdfUpload = document.querySelector('input[name=pdf-upload]');
const signatureUpload = document.querySelector('input[name=signature-upload]');
- const signatureTextInput = document.querySelector('input[name=signatureTextInput]');
const pdfCanvas = document.getElementById('pdf-canvas');
const signatureCanvas = document.getElementById('signature-canvas');
const downloadPdfBtn = document.getElementById('download-pdf');
@@ -132,44 +124,17 @@
signaturePad.clear();
});
- $("input[name=signature-type]").change(function () {
- const drawSignatureInput = document.getElementById("draw-signature");
- const generateSignatureInput = document.getElementById("generate-signature");
- const importImageInputContainer = document.querySelector("input[name=signature-upload]").closest(".custom-file-chooser");
- signaturePadContainer.style.display = drawSignatureInput.checked ? "block" : "none";
- importImageInputContainer.style.display = drawSignatureInput.checked ? "none" : (generateSignatureInput.checked ? "none" : "block");
- document.getElementById("signature-text-input-container").style.display = generateSignatureInput.checked ? "block" : "none";
+ $("input[name=signature-type]").change(function() {
+ const drawSignatureInput = document.getElementById('draw-signature');
+ signaturePadContainer.style.display = drawSignatureInput.checked ? 'block' : 'none';
+ document.querySelector('input[name=signature-upload]').closest(".custom-file-chooser").style.display = drawSignatureInput.checked ? 'none' : 'block';
if (drawSignatureInput.checked) {
populateSignatureFromPad();
- } else if (generateSignatureInput.checked) {
- populateSignatureFromText();
} else {
populateSignatureFromFileUpload();
}
});
-
-
- function populateSignatureFromText() {
- const signatureText = document.getElementById("signature-text-input").value;
- if (!signatureText) return;
-
- const canvas = document.createElement("canvas");
- const ctx = canvas.getContext("2d");
- ctx.font = "32px Arial";
- const textMetrics = ctx.measureText(signatureText);
-
- canvas.width = textMetrics.width;
- canvas.height = parseInt(ctx.font, 10);
-
- ctx.fillStyle = "black";
- ctx.font = "32px Arial";
- ctx.fillText(signatureText, 0, canvas.height * 0.8);
-
- const dataURL = canvas.toDataURL();
- populateSignature(dataURL);
- }
-
function populateSignature(imgUrl) {
const img = new Image();
@@ -219,7 +184,6 @@
populateSignature(dataURL);
}
signatureUpload.addEventListener('change', populateSignatureFromFileUpload);
- signatureTextInput.addEventListener('change', populateSignatureFromText);
saveSignatureBtn.addEventListener('click', populateSignatureFromPad);