diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java index 08f1dfeb7..f787831e9 100644 --- a/app/core/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java +++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java @@ -58,10 +58,11 @@ public class SplitPdfBySectionsController { MultipartFile file = request.getFileInput(); String pageNumbers = request.getPageNumbers(); - SplitTypes splitMode = Optional.ofNullable(request.getSplitMode()) - .map(SplitTypes::valueOf) - .orElse(SplitTypes.SPLIT_ALL); - + SplitTypes splitMode = + Optional.ofNullable(request.getSplitMode()) + .map(SplitTypes::valueOf) + .orElse(SplitTypes.SPLIT_ALL); + PDDocument sourceDocument = pdfDocumentFactory.load(file); Set pagesToSplit = diff --git a/app/core/src/main/resources/messages_en_GB.properties b/app/core/src/main/resources/messages_en_GB.properties index e3579ef48..af727ea48 100644 --- a/app/core/src/main/resources/messages_en_GB.properties +++ b/app/core/src/main/resources/messages_en_GB.properties @@ -1588,7 +1588,7 @@ split-by-sections.submit=Split PDF split-by-sections.merge=Merge Into One PDF split-by-sections.pageToSplit=Pages to split (Enter a comma-separated list of page numbers) : split-by-sections.pageToSplit.placeholder=(e.g. 1,2,6) -split-by-sections.mode=Mode +split-by-sections.mode=Split Mode split-by-sections.mode.1=Split all except first and last split-by-sections.mode.2=Split all except first split-by-sections.mode.3=Split all except last diff --git a/app/core/src/main/resources/static/css/split-pdf-by-sections.css b/app/core/src/main/resources/static/css/split-pdf-by-sections.css index 7520c10e5..b949000af 100644 --- a/app/core/src/main/resources/static/css/split-pdf-by-sections.css +++ b/app/core/src/main/resources/static/css/split-pdf-by-sections.css @@ -8,3 +8,6 @@ position: absolute; background-color: red; /* Line color */ } +#pageToSplitSection { + display: none; +} diff --git a/app/core/src/main/resources/templates/split-pdf-by-sections.html b/app/core/src/main/resources/templates/split-pdf-by-sections.html index 8c0e2bb62..3ea76bf57 100644 --- a/app/core/src/main/resources/templates/split-pdf-by-sections.html +++ b/app/core/src/main/resources/templates/split-pdf-by-sections.html @@ -21,7 +21,7 @@
- +
-
+
+ th:placeholder="#{split-by-sections.pageToSplit.placeholder}">
@@ -95,11 +95,17 @@ this.value = this.value.replace(/\s+/g, '');; }); - // Only enable the page list input field when split mode is custom. + // Only display the page input field when split mode is custom. function togglePageInput() { const mode = document.getElementById('splitMode').value; - const pageListInput = document.getElementById('pageToSplit'); - pageListInput.disabled = mode !== "CUSTOM"; + const pageInputSection = document.getElementById('pageToSplitSection'); + if (mode === "CUSTOM") { + pageInputSection.style.display = "block"; + document.getElementById('pageToSplit').setAttribute("required", "true"); + } else { + pageInputSection.style.display = "none"; + document.getElementById('pageToSplit').removeAttribute("required", "true"); + } } document.getElementById('splitMode').addEventListener('change', togglePageInput);