From 89e461e4f63f19177c1c68f1b74e069cd0e01d31 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 28 Jan 2024 17:39:07 +0000 Subject: [PATCH] formats --- .../api/misc/FakeScanControllerWIP.java | 3 +- .../controller/api/misc/StampController.java | 28 +++++++++++++++---- .../api/pipeline/ApiDocService.java | 2 +- .../controller/web/OtherWebController.java | 3 +- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java index 99595049..cf719f56 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java @@ -29,7 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -50,7 +49,7 @@ public class FakeScanControllerWIP { // TODO @Hidden - //@PostMapping(consumes = "multipart/form-data", value = "/fakeScan") + // @PostMapping(consumes = "multipart/form-data", value = "/fakeScan") @Operation( summary = "Repair a PDF file", description = diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index 718c0ddd..0dd4200c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -201,7 +201,15 @@ public class StampController { x = overrideX; y = overrideY; } else { - x = calculatePositionX(pageSize, position, fontSize, font, fontSize, watermarkText, marginFactor); + x = + calculatePositionX( + pageSize, + position, + fontSize, + font, + fontSize, + watermarkText, + marginFactor); y = calculatePositionY(pageSize, position, fontSize, marginFactor); } @@ -247,7 +255,9 @@ public class StampController { x = overrideX; y = overrideY; } else { - x = calculatePositionX(pageSize, position, desiredPhysicalWidth, null, 0, null, marginFactor); + x = + calculatePositionX( + pageSize, position, desiredPhysicalWidth, null, 0, null, marginFactor); y = calculatePositionY(pageSize, position, fontSize, marginFactor); } @@ -259,8 +269,16 @@ public class StampController { } private float calculatePositionX( - PDRectangle pageSize, int position, float contentWidth, PDFont font, float fontSize, String text, float marginFactor) throws IOException { - float actualWidth = (text != null) ? calculateTextWidth(text, font, fontSize) : contentWidth; + PDRectangle pageSize, + int position, + float contentWidth, + PDFont font, + float fontSize, + String text, + float marginFactor) + throws IOException { + float actualWidth = + (text != null) ? calculateTextWidth(text, font, fontSize) : contentWidth; switch (position % 3) { case 1: // Left return pageSize.getLowerLeftX() + marginFactor * pageSize.getWidth(); @@ -277,8 +295,6 @@ public class StampController { return font.getStringWidth(text) / 1000 * fontSize; } - - private float calculatePositionY( PDRectangle pageSize, int position, float height, float marginFactor) { switch ((position - 1) / 3) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java index 25537ee2..27240b6f 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java @@ -66,7 +66,7 @@ public class ApiDocService { "BOOK", Arrays.asList( "epub", "mobi", "azw3", "fb2", "txt", - "docx")); // As noted before, "Boolean" isn't a file type but a value + "docx")); // type. } diff --git a/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java b/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java index 69609536..a7c10908 100644 --- a/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java +++ b/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java @@ -38,14 +38,13 @@ public class OtherWebController { model.addAttribute("currentPage", "show-javascript"); return "misc/show-javascript"; } - + @GetMapping("/stamp") @Hidden public String stampForm(Model model) { model.addAttribute("currentPage", "stamp"); return "misc/stamp"; } - @GetMapping("/add-page-numbers") @Hidden