From 005b158ad340aa55a6353fa45a15440871d022d4 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Wed, 31 May 2023 18:44:32 +0100 Subject: [PATCH] naming fix --- .../controller/api/other/MultiPageLayoutController.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/other/MultiPageLayoutController.java b/src/main/java/stirling/software/SPDF/controller/api/other/MultiPageLayoutController.java index 458e06e9..c82e5f4a 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/other/MultiPageLayoutController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/other/MultiPageLayoutController.java @@ -6,7 +6,6 @@ import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -25,6 +24,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.PdfUtils; @RestController public class MultiPageLayoutController { @@ -92,9 +92,8 @@ public class MultiPageLayoutController { outputPdf.close(); byte[] pdfContent = baos.toByteArray(); pdfDoc.close(); - return ResponseEntity.ok() - .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"modifiedDocument.pdf\"") - .body(pdfContent); + + return PdfUtils.bytesToWebResponse(pdfContent, file.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_layoutChanged.pdf"); } }