diff --git a/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java b/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java index 686a6b38..6bdb0074 100644 --- a/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java +++ b/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java @@ -165,7 +165,7 @@ public class EndpointConfiguration { addEndpointToGroup("Java", "change-metadata"); addEndpointToGroup("Java", "cert-sign"); addEndpointToGroup("Java", "multi-page-layout"); - + addEndpointToGroup("Java", "scale-pages"); //Javascript diff --git a/src/main/java/stirling/software/SPDF/controller/api/other/MultiPageLayoutController.java b/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java similarity index 98% rename from src/main/java/stirling/software/SPDF/controller/api/other/MultiPageLayoutController.java rename to src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java index ef1b699e..7dc9c51f 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/other/MultiPageLayoutController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java @@ -1,4 +1,4 @@ -package stirling.software.SPDF.controller.api.other; +package stirling.software.SPDF.controller.api; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/src/main/java/stirling/software/SPDF/controller/api/other/ScalePagesController.java b/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java similarity index 93% rename from src/main/java/stirling/software/SPDF/controller/api/other/ScalePagesController.java rename to src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java index 8db0fa80..a5f874b2 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/other/ScalePagesController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java @@ -1,4 +1,4 @@ -package stirling.software.SPDF.controller.api.other; +package stirling.software.SPDF.controller.api; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -25,6 +25,7 @@ import com.itextpdf.kernel.pdf.xobject.PdfFormXObject; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; +import stirling.software.SPDF.utils.WebResponseUtils; @RestController public class ScalePagesController { @@ -81,8 +82,6 @@ public class ScalePagesController { outputPdf.close(); byte[] pdfContent = baos.toByteArray(); pdfDoc.close(); - return ResponseEntity.ok() - .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_modified.pdf\"") - .body(pdfContent); + return WebResponseUtils.bytesToWebResponse(pdfContent, file.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_scaled.pdf"); } } diff --git a/src/main/resources/static/images/scale-pages.svg b/src/main/resources/static/images/scale-pages.svg index bc505957..dc0acc3c 100644 --- a/src/main/resources/static/images/scale-pages.svg +++ b/src/main/resources/static/images/scale-pages.svg @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/src/main/resources/templates/other/scale-pages.html b/src/main/resources/templates/other/scale-pages.html index d6abd561..b2acd961 100644 --- a/src/main/resources/templates/other/scale-pages.html +++ b/src/main/resources/templates/other/scale-pages.html @@ -2,7 +2,7 @@ - +