diff --git a/build.gradle b/build.gradle index 0afc366b..688bee00 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'stirling.software' -version = '0.11.0' +version = '0.11.2' sourceCompatibility = '17' repositories { diff --git a/images/stirling-home.png b/images/stirling-home.png index 47d03b05..27241bf4 100644 Binary files a/images/stirling-home.png and b/images/stirling-home.png differ diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java index d19a24b6..d4964196 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java @@ -43,7 +43,7 @@ public class ConvertImgPDFController { @Parameter(description = "Choose between a single image containing all pages or separate images for each page", schema = @Schema(allowableValues = {"single", "multiple"})) String singleOrMultiple, @RequestParam("colorType") - @Parameter(description = "The color type of the output image(s)", schema = @Schema(allowableValues = {"rgb", "greyscale", "blackwhite"})) + @Parameter(description = "The color type of the output image(s)", schema = @Schema(allowableValues = {"color", "greyscale", "blackwhite"})) String colorType, @RequestParam("dpi") @Parameter(description = "The DPI (dots per inch) for the output image(s)") @@ -94,7 +94,7 @@ public class ConvertImgPDFController { @Parameter(description = "Whether to stretch the images to fit the PDF page or maintain the aspect ratio", example = "false") boolean stretchToFit, @RequestParam("colorType") - @Parameter(description = "The color type of the output image(s)", schema = @Schema(allowableValues = {"rgb", "greyscale", "blackwhite"})) + @Parameter(description = "The color type of the output image(s)", schema = @Schema(allowableValues = {"color", "greyscale", "blackwhite"})) String colorType, @RequestParam(defaultValue = "false", name = "autoRotate") @Parameter(description = "Whether to automatically rotate the images to better fit the PDF page", example = "true") diff --git a/src/main/java/stirling/software/SPDF/controller/web/GeneralWebController.java b/src/main/java/stirling/software/SPDF/controller/web/GeneralWebController.java index dcf953a5..75d67401 100644 --- a/src/main/java/stirling/software/SPDF/controller/web/GeneralWebController.java +++ b/src/main/java/stirling/software/SPDF/controller/web/GeneralWebController.java @@ -1,30 +1,25 @@ package stirling.software.SPDF.controller.web; - -import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.core.io.support.ResourcePatternUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.HashMap; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; - import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.v3.oas.annotations.Hidden; @@ -123,18 +118,30 @@ public class GeneralWebController { model.addAttribute("fonts", getFontNames()); return "sign"; } + + @Autowired + private ResourceLoader resourceLoader; + private List getFontNames() { try { - return Files.list(Paths.get("src/main/resources/static/fonts")) - .map(Path::getFileName) - .map(Path::toString) - .filter(name -> name.endsWith(".woff2")) - .map(name -> name.substring(0, name.length() - 6)) // Remove .woff2 extension + Resource[] resources = ResourcePatternUtils.getResourcePatternResolver(resourceLoader) + .getResources("classpath:static/fonts/*.woff2"); + + return Arrays.stream(resources) + .map(resource -> { + try { + String filename = resource.getFilename(); + return filename.substring(0, filename.length() - 6); // Remove .woff2 extension + } catch (Exception e) { + throw new RuntimeException("Error processing filename", e); + } + }) .collect(Collectors.toList()); - } catch (IOException e) { + } catch (Exception e) { throw new RuntimeException("Failed to read font directory", e); } } + @GetMapping("/crop") diff --git a/src/main/resources/messages_ar_AR.properties b/src/main/resources/messages_ar_AR.properties index 9f3d30c6..96a53cec 100644 --- a/src/main/resources/messages_ar_AR.properties +++ b/src/main/resources/messages_ar_AR.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_ca_CA.properties b/src/main/resources/messages_ca_CA.properties index fb29aa6b..bec93536 100644 --- a/src/main/resources/messages_ca_CA.properties +++ b/src/main/resources/messages_ca_CA.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_de_DE.properties b/src/main/resources/messages_de_DE.properties index 04f31beb..1ed74f91 100644 --- a/src/main/resources/messages_de_DE.properties +++ b/src/main/resources/messages_de_DE.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_en_GB.properties b/src/main/resources/messages_en_GB.properties index e18ee264..0d881b65 100644 --- a/src/main/resources/messages_en_GB.properties +++ b/src/main/resources/messages_en_GB.properties @@ -309,6 +309,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_es_ES.properties b/src/main/resources/messages_es_ES.properties index dbdc0a17..4dd868af 100644 --- a/src/main/resources/messages_es_ES.properties +++ b/src/main/resources/messages_es_ES.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Escanee todos sus documentos a la vez insertando la ho autoSplitPDF.selectText.3=Cargue un único archivo PDF escaneado de gran tamaño y deje que Stirling PDF se encargue del resto. autoSplitPDF.selectText.4=Las páginas divisorias son automáticamente detectadas y eliminadas, garantizando un buen documento final. autoSplitPDF.formPrompt=Entregar PDF conteniendo divisores de página de Stirling-PDF: +autoSplitPDF.duplexMode=Modo Dúplex (Escaneado de ambas caras) autoSplitPDF.dividerDownload1=Descargar 'Auto Splitter Divider (mínima).pdf' autoSplitPDF.dividerDownload2=Descargar 'Auto Splitter Divider (con instrucciones).pdf' autoSplitPDF.submit=Entregar diff --git a/src/main/resources/messages_eu_ES.properties b/src/main/resources/messages_eu_ES.properties index 1149b8ca..96db8581 100644 --- a/src/main/resources/messages_eu_ES.properties +++ b/src/main/resources/messages_eu_ES.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_fr_FR.properties b/src/main/resources/messages_fr_FR.properties index b5e67732..86eb1fc6 100644 --- a/src/main/resources/messages_fr_FR.properties +++ b/src/main/resources/messages_fr_FR.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_it_IT.properties b/src/main/resources/messages_it_IT.properties index 25a5bc82..e8d706b0 100644 --- a/src/main/resources/messages_it_IT.properties +++ b/src/main/resources/messages_it_IT.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_ja_JP.properties b/src/main/resources/messages_ja_JP.properties index ac20e9ec..fe6086e7 100644 --- a/src/main/resources/messages_ja_JP.properties +++ b/src/main/resources/messages_ja_JP.properties @@ -462,6 +462,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_ko_KR.properties b/src/main/resources/messages_ko_KR.properties index 956aad6d..cd01f417 100644 --- a/src/main/resources/messages_ko_KR.properties +++ b/src/main/resources/messages_ko_KR.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_pl_PL.properties b/src/main/resources/messages_pl_PL.properties index 7c78541c..7ea64167 100644 --- a/src/main/resources/messages_pl_PL.properties +++ b/src/main/resources/messages_pl_PL.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_pt_BR.properties b/src/main/resources/messages_pt_BR.properties index f6e4cda1..3b98b0e6 100644 --- a/src/main/resources/messages_pt_BR.properties +++ b/src/main/resources/messages_pt_BR.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_ro_RO.properties b/src/main/resources/messages_ro_RO.properties index e28e9d8d..e66a6fc5 100644 --- a/src/main/resources/messages_ro_RO.properties +++ b/src/main/resources/messages_ro_RO.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_ru_RU.properties b/src/main/resources/messages_ru_RU.properties index 5b509f46..28b0a1e7 100644 --- a/src/main/resources/messages_ru_RU.properties +++ b/src/main/resources/messages_ru_RU.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_sv_SE.properties b/src/main/resources/messages_sv_SE.properties index d8552725..0e833124 100644 --- a/src/main/resources/messages_sv_SE.properties +++ b/src/main/resources/messages_sv_SE.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/messages_zh_CN.properties b/src/main/resources/messages_zh_CN.properties index 447a4ec4..d1b3b578 100644 --- a/src/main/resources/messages_zh_CN.properties +++ b/src/main/resources/messages_zh_CN.properties @@ -429,6 +429,7 @@ autoSplitPDF.selectText.2=Scan all your documents at once by inserting the divid autoSplitPDF.selectText.3=Upload the single large scanned PDF file and let Stirling PDF handle the rest. autoSplitPDF.selectText.4=Divider pages are automatically detected and removed, guaranteeing a neat final document. autoSplitPDF.formPrompt=Submit PDF containing Stirling-PDF Page dividers: +autoSplitPDF.duplexMode=Duplex Mode (Front and back scanning) autoSplitPDF.dividerDownload1=Download 'Auto Splitter Divider (minimal).pdf' autoSplitPDF.dividerDownload2=Download 'Auto Splitter Divider (with instructions).pdf' autoSplitPDF.submit=Submit diff --git a/src/main/resources/static/js/downloader.js b/src/main/resources/static/js/downloader.js index e9abdf38..d06d82dc 100644 --- a/src/main/resources/static/js/downloader.js +++ b/src/main/resources/static/js/downloader.js @@ -154,11 +154,22 @@ async function submitMultiPdfForm(url, files) { if (zipFiles) { jszip = new JSZip(); } - + + + // Get the form with the method attribute set to POST + let postForm = document.querySelector('form[method="POST"]'); + // Get existing form data - let formData = new FormData($('form')[0]); + let formData; + if (postForm) { + formData = new FormData($(postForm)[0]); // Convert the form to a jQuery object and get the raw DOM element + } else { + console.log("No form with POST method found."); + } + //Remove file to reuse parameters for other runs formData.delete('fileInput'); + const CONCURRENCY_LIMIT = 8; const chunks = []; for (let i = 0; i < Array.from(files).length; i += CONCURRENCY_LIMIT) { @@ -169,10 +180,11 @@ async function submitMultiPdfForm(url, files) { const promises = chunk.map(async file => { let fileFormData = new FormData(); fileFormData.append('fileInput', file); - + console.log(fileFormData); // Add other form data for (let pair of formData.entries()) { fileFormData.append(pair[0], pair[1]); + console.log(pair[0]+ ', ' + pair[1]); } try { diff --git a/src/main/resources/templates/convert/img-to-pdf.html b/src/main/resources/templates/convert/img-to-pdf.html index b64f43f1..3182eb9d 100644 --- a/src/main/resources/templates/convert/img-to-pdf.html +++ b/src/main/resources/templates/convert/img-to-pdf.html @@ -31,7 +31,7 @@
- diff --git a/src/main/resources/templates/convert/pdf-to-html.html b/src/main/resources/templates/convert/pdf-to-html.html index 16e0a39b..4e28471c 100644 --- a/src/main/resources/templates/convert/pdf-to-html.html +++ b/src/main/resources/templates/convert/pdf-to-html.html @@ -1,7 +1,7 @@ - +
@@ -11,14 +11,14 @@
-

-
+

+

- +
-

+