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 1ea8992c..06f964f4 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 @@ -208,7 +208,13 @@ public class ConvertImgPDFController { String fitOption = request.getFitOption(); String colorType = request.getColorType(); boolean autoRotate = request.isAutoRotate(); - + // Handle Null entries for formdata + if (colorType == null || colorType.isBlank()) { + colorType = "color"; + } + if (fitOption == null || fitOption.isEmpty()) { + fitOption = "fillPage"; + } // Convert the file to PDF and get the resulting bytes byte[] bytes = PdfUtils.imageToPdf(file, fitOption, autoRotate, colorType, pdfDocumentFactory); diff --git a/src/main/resources/static/js/downloader.js b/src/main/resources/static/js/downloader.js index 56319543..894c67da 100644 --- a/src/main/resources/static/js/downloader.js +++ b/src/main/resources/static/js/downloader.js @@ -415,8 +415,9 @@ const promises = chunk.map(async (file) => { let fileFormData = new FormData(); fileFormData.append('fileInput', file); - console.log(fileFormData); - // Add other form data + for (let [key, value] of fileFormData.entries()) { + console.log(key, value); + } // Add other form data for (let pair of formData.entries()) { fileFormData.append(pair[0], pair[1]); console.log(pair[0] + ', ' + pair[1]); diff --git a/src/main/resources/static/js/pages/adjust-contrast.js b/src/main/resources/static/js/pages/adjust-contrast.js index 792c0666..a9692d2b 100644 --- a/src/main/resources/static/js/pages/adjust-contrast.js +++ b/src/main/resources/static/js/pages/adjust-contrast.js @@ -222,7 +222,7 @@ async function downloadPDF() { // Event listeners document.getElementById('fileInput-input').addEventListener('change', function (e) { - const fileInput = event.target; + const fileInput = e.target; fileInput.addEventListener('file-input-change', async (e) => { const {allFiles} = e.detail; if (allFiles && allFiles.length > 0) { diff --git a/src/main/resources/templates/convert/img-to-pdf.html b/src/main/resources/templates/convert/img-to-pdf.html index 9ac3110e..fa0fc74f 100644 --- a/src/main/resources/templates/convert/img-to-pdf.html +++ b/src/main/resources/templates/convert/img-to-pdf.html @@ -17,7 +17,7 @@
-