formats
This commit is contained in:
parent
ba4ad1aff9
commit
89e461e4f6
4 changed files with 25 additions and 11 deletions
|
@ -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 =
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue